File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
src/include/storage/index Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -230,9 +230,12 @@ void BPLUSTREE_TYPE::BatchOpsFromFile(const std::filesystem::path &file_name) {
230
230
int64_t key;
231
231
char instruction;
232
232
std::ifstream input (file_name);
233
- while (input) {
234
- input >> instruction >> key;
235
- RID rid (key);
233
+ if (!input.is_open ()) {
234
+ std::cerr << " Failed to open file: " << file_name << std::endl;
235
+ return ;
236
+ }
237
+ while (input >> instruction >> key) {
238
+ RID rid (static_cast <int32_t >(key >> 32 ), static_cast <int >(key & 0xFFFFFFFF ));
236
239
KeyType index_key;
237
240
index_key.SetFromInteger (key);
238
241
switch (instruction) {
@@ -243,9 +246,14 @@ void BPLUSTREE_TYPE::BatchOpsFromFile(const std::filesystem::path &file_name) {
243
246
Remove (index_key);
244
247
break ;
245
248
default :
249
+ std::cerr << " Unknown instruction: " << instruction << std::endl;
246
250
break ;
247
251
}
248
252
}
253
+ if (input.bad ()) {
254
+ std::cerr << " Error reading file: " << file_name << std::endl;
255
+ }
256
+ input.close ();
249
257
}
250
258
251
259
INDEX_TEMPLATE_ARGUMENTS
You can’t perform that action at this time.
0 commit comments