Skip to content

Commit

Permalink
twom: neater check code
Browse files Browse the repository at this point in the history
  • Loading branch information
brong committed Jan 6, 2025
1 parent 2e909d3 commit 27ac4cc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/cyrusdb_twom.c
Original file line number Diff line number Diff line change
Expand Up @@ -2000,10 +2000,10 @@ static int mycheckpoint(struct dbengine *db)
r = opendb(newfname, flags, &cr.db, &cr.tid);
if (r) return r;

// has it already repacked?
if (cr.db->openfile->header.num_records ||
cr.db->openfile->header.generation > 1 ||
!memcmp(cr.db->openfile->header.uuid, db->openfile->header.uuid, 16)) {
// did we lose the race? (same uuid, higher generation, records exist)
if (!memcmp(cr.db->openfile->header.uuid, db->openfile->header.uuid, 16)
|| cr.db->openfile->header.generation > 1
|| cr.db->openfile->header.num_records) {
r = myabort(cr.db, cr.tid);
if (r) goto err;
myclose(cr.db);
Expand Down

0 comments on commit 27ac4cc

Please sign in to comment.