Skip to content

Commit 1da0369

Browse files
committed
Fix extracting unique reference of oplog documents on Mongo >=7.1.0
The h field was removed, replaced with ts. Issue: ARSN-545 Signed-off-by: Thomas Flament <thomas.flament@scality.com>
1 parent c237522 commit 1da0369

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/storage/metadata/mongoclient/ListRecordStream.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class ListRecordStream extends stream.Readable {
6363

6464
_processItem(itemObj) {
6565
// always update to most recent uniqID
66-
this._lastConsumedID = itemObj.h.toString();
66+
this._lastConsumedID = (itemObj.h || itemObj.ts).toString();
6767

6868
// only push to stream unpublished objects
6969
if (!this._lastSavedID) {

lib/storage/metadata/mongoclient/LogConsumer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class LogConsumer {
117117
if (!data || data.length === 0) {
118118
return cb(new Error('no oplog entry found'));
119119
}
120-
const latestOplogID = data[0].h.toString();
120+
const latestOplogID = (data[0].h || data[0].ts).toString();
121121
this._logger.debug('latest oplog ID read', { latestOplogID });
122122
return cb(null, latestOplogID);
123123
})

0 commit comments

Comments
 (0)