Skip to content

Commit

Permalink
Fix: temporarily back-date revision number during driver detection
Browse files Browse the repository at this point in the history
  • Loading branch information
prdoyle committed Jan 31, 2024
1 parent 1376ecc commit 408d063
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,17 @@ private FormatDriver<R> detectFormat() throws UninitializedCollectionException,
BsonInt64 revision = cursor
.next()
.getInt64(DocumentFields.revision.name(), REVISION_ZERO);
return newFormatDriver(revision.longValue(), format);

// We're in the midst of loading the existing state, so at this point,
// the downstream driver has not yet "already seen" the current database
// contents. So we temporarily "back-date" the revision number; that way,
// any flush operations that occur before we send this state downstream will wait.
// After sending the state downstream, the caller will call onRevisionToSkip,
// thereby establishing the correct revision number.
// TODO: We really need a better way to deal with revision numbers
long revisionAlreadySeen = revision.longValue()-1;

return newFormatDriver(revisionAlreadySeen, format);
} else {
// Note that this message is confusing if the user specified
// a preference for Pando but no manifest file exists, because
Expand Down

0 comments on commit 408d063

Please sign in to comment.