Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP support for new resume token format #2

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
},
"license": "SSPL",
"dependencies": {
"bson": "^4.5.1"
"bson": "^4.6.3"
},
"devDependencies": {
"@types/mocha": "^8.0.3",
Expand Down
14 changes: 14 additions & 0 deletions test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,18 @@ describe('decodeResumeToken', function() {
documentKey: null
});
});

// See PM-1950
it('can decode new resume tokens', async() => {
const decoded = decodeResumeToken('826273BCD2000000012B022C0100296E5A1004808BBE9298B0403286C29EA48C4E162846645F696400646273BCD27257D30393BB73F70004');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got this from a change stream in mongodb 6.0-rc0, but I'm now unsure if it is the new format or the old.

assert.deepStrictEqual(decoded, {
timestamp: new bson.Timestamp({ t: 1651752146, i: 1 }),
version: 1,
tokenType: 128,
txnOpIndex: 0,
fromInvalidate: false,
uuid: new bson.UUID('808bbe92-98b0-4032-86c2-9ea48c4e1628'),
documentKey: { _id: new bson.ObjectId('6273bcd27257d30393bb73f7') }
});
});
});