Skip to content

Commit 1181138

Browse files
authored
fix: InsertFromFile() and RemoveFromFile() read extra value (#567)
1 parent b3577ef commit 1181138

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/storage/index/b_plus_tree.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,7 @@ INDEX_TEMPLATE_ARGUMENTS
123123
void BPLUSTREE_TYPE::InsertFromFile(const std::string &file_name, Transaction *txn) {
124124
int64_t key;
125125
std::ifstream input(file_name);
126-
while (input) {
127-
input >> key;
128-
126+
while (input >> key) {
129127
KeyType index_key;
130128
index_key.SetFromInteger(key);
131129
RID rid(key);
@@ -140,8 +138,7 @@ INDEX_TEMPLATE_ARGUMENTS
140138
void BPLUSTREE_TYPE::RemoveFromFile(const std::string &file_name, Transaction *txn) {
141139
int64_t key;
142140
std::ifstream input(file_name);
143-
while (input) {
144-
input >> key;
141+
while (input >> key) {
145142
KeyType index_key;
146143
index_key.SetFromInteger(key);
147144
Remove(index_key, txn);

0 commit comments

Comments
 (0)