|
The recipient needs to use an aggregate or find to copy the donor's config.transactions entries with "state: committed" and lastWriteOpTime < startApplyingOpTime, and put these entries into the recipient's config.transactions with a null lastWriteOpTime.
This ticket is to write the exact aggregate pipeline that can be used to do this, and to write a test that uses it to fetch the entries from a donor and insert them into a recipient's config.transactions, then confirm that a commitTransaction retry against the recipient returns success.
The query shape would look something like:
// Get all config.transactions entries for committed transactions whose lastWriteOpTime
|
// is less than the migration's startApplyingOpTime.
|
{
|
aggregate: "transactions",
|
pipeline: [
|
{$match: {"lastWriteOpTime.ts": {$lt: <startApplyingTimestamp>, "state": "committed"}}},
|
],
|
readConcern: {level: "majority", afterClusterTime: <startApplyingTimestamp>},
|
hint: "_id_",
|
cursor: {},
|
}
|
|