Skip to content

Commit

Permalink
ITS#10125 mdb_load: fix cursor reinit in Append mode
Browse files Browse the repository at this point in the history
  • Loading branch information
hyc committed Nov 5, 2023
1 parent 053ba2c commit e9e66a2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions external/db_drivers/liblmdb/mdb_load.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ int main(int argc, char *argv[])
if (rc == MDB_KEYEXIST && putflags)
continue;
if (rc) {
fprintf(stderr, "mdb_cursor_put failed, error %d %s\n", rc, mdb_strerror(rc));
fprintf(stderr, "%s: line %"Yu": mdb_cursor_put failed, error %d %s\n", prog, lineno, rc, mdb_strerror(rc));
goto txn_abort;
}
batch++;
Expand All @@ -466,9 +466,11 @@ int main(int argc, char *argv[])
fprintf(stderr, "mdb_cursor_open failed, error %d %s\n", rc, mdb_strerror(rc));
goto txn_abort;
}
if (appflag & MDB_APPENDDUP) {
if (append) {
MDB_val k, d;
mdb_cursor_get(mc, &k, &d, MDB_LAST);
memcpy(prevk.mv_data, k.mv_data, k.mv_size);
prevk.mv_size = k.mv_size;
}
batch = 0;
}
Expand Down

0 comments on commit e9e66a2

Please sign in to comment.