[SERVER-76807] The split prepared transaction mechanism causes opTimes for non-retryable internal transactions to get added to the session migration new opTime buffer Created: 03/May/23  Updated: 29/Oct/23  Resolved: 17/May/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.1.0-rc0, 7.0.0-rc2

Type: Bug Priority: Major - P3
Reporter: Cheahuychou Mao Assignee: Cheahuychou Mao
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
related to SERVER-76806 Make SessionCatalogMigrationSource ne... Closed
related to SERVER-77187 Consider making SplitPrepareSessionMa... Closed
Assigned Teams:
Sharding NYC
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v7.0
Sprint: Sharding NYC 2023-05-29
Participants:
Linked BF Score: 135

 Description   

Non-retryable internal transactions refer to internal transactions started internally to execute some write for a client with retryWrite: false session. Such transactions always have session id of the form (id, uid, txnUUID) where where id is the id of the client session and txnUUID is an internally generated UUID. Such session ids are exclusively used to run internal transactions so they can never be used to run retryable writes. As such, they are not migrated during chunk migration. Currently, this is how they are excluded from session migration:

  • The SessionCatalogMigrationSource filters out all sessions with session id of the form (id, uid, txnUUID) when it looks up existing sessions to migrate.
  • The LogTransactionOperationsForShardingHandler does not add the opTime for transactions with session of the form (id, uid, txnUUID) to the new opTime buffer.

However, there have been some recent changes that can cause the the opTime for a non-retryable write internal transaction to end up in the new opTime buffer:

BF-28542 contains an example of how issue this manifests.

As a quick fix, SERVER-76806 will make SessionCatalogMigrationSource::_fetchNextNewWriteOplog just discard non-retryable internal transaction oplog entries it sees. Ideally, we should find a way to avoid adding the opTimes for non-retryable internal transactions to the SessionMigrationCatalogSource _newWriteOpTimeList buffer to avoid the wasted work on looking up the oplog entry here.



 Comments   
Comment by Githook User [ 17/May/23 ]

Author:

{'name': 'Cheahuychou Mao', 'email': 'mao.cheahuychou@gmail.com', 'username': 'cheahuychou'}

Message: SERVER-76807 Avoid adding opTimes for non-retryable internal transactions to the session migration new opTime buffer
Branch: v7.0
https://github.com/mongodb/mongo/commit/6fc76115eb09c0cd17f5a3f411d14ca0d4aaf270

Comment by Githook User [ 16/May/23 ]

Author:

{'name': 'Cheahuychou Mao', 'email': 'mao.cheahuychou@gmail.com', 'username': 'cheahuychou'}

Message: SERVER-76807 Avoid adding opTimes for non-retryable internal transactions to the session migration new opTime buffer
Branch: master
https://github.com/mongodb/mongo/commit/9354aa6ccf769929ed3e7bd09f0dd95f8ab3a2a2

Generated at Thu Feb 08 06:33:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.