[SERVER-59831] WTUniqueIndex::_insert expects secondaries to pass in dupsAllowed=true Created: 08/Sep/21  Updated: 29/Oct/23  Resolved: 19/Nov/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.2.0

Type: Bug Priority: Major - P3
Reporter: Daniel Gottlieb (Inactive) Assignee: Yuhong Zhang
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-61459 ShardingCatalogManager::assignKeyRang... Closed
Duplicate
is duplicated by SERVER-60716 Remove out of order writes on unique,... Closed
Problem/Incident
Related
related to SERVER-61458 Calling RSLocalClient::queryOnce(kMaj... Closed
related to SERVER-61499 Complete TODO listed in SERVER-60716 Closed
related to WT-7853 Validate the update chain before we a... Closed
is related to SERVER-60037 Enable the ordered timestamp assertio... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Execution Team 2021-11-15, Execution Team 2021-11-29
Participants:
Linked BF Score: 152

 Description   

Using dupsAllowed=false when inserting into a secondary unique index results in inserting + removing on a "prefix" document to serialize access to enforce unique constraints.

However the preceding comment states the expectation that only primaries are executing that code path.

This results in unnecessary writes to these prefix documents. Moreover, these writes can result in out of order update chains as secondaries can process oplog entries out of order.



 Comments   
Comment by Githook User [ 19/Nov/21 ]

Author:

{'name': 'Yuhong Zhang', 'email': 'danielzhangyh@gmail.com', 'username': 'YuhongZhang98'}

Message: SERVER-59831 Pass `dupsAllowed=true` to `WiredTigerIndexUnique::_insert` on secondaries
Branch: master
https://github.com/mongodb/mongo/commit/88bd9ede7754014ab16141bee4208b7949711e9d

Comment by Githook User [ 11/Nov/21 ]

Author:

{'name': 'Yuhong Zhang', 'email': 'danielzhangyh@gmail.com', 'username': 'YuhongZhang98'}

Message: Revert "SERVER-59831 Pass `dupsAllowed=true` to `WiredTigerIndexUnique::_insert` on secondaries"

This reverts commit a52ee5999b0fc7adcbce77b37a7313d4585a4cbf.
Branch: master
https://github.com/mongodb/mongo/commit/c5aa4a5f2035733b85ee55edcf7b74b530db29e7

Comment by Githook User [ 04/Nov/21 ]

Author:

{'name': 'Yuhong Zhang', 'email': 'danielzhangyh@gmail.com', 'username': 'YuhongZhang98'}

Message: SERVER-59831 Pass `dupsAllowed=true` to `WiredTigerIndexUnique::_insert` on secondaries
Branch: master
https://github.com/mongodb/mongo/commit/a52ee5999b0fc7adcbce77b37a7313d4585a4cbf

Comment by Daniel Gottlieb (Inactive) [ 09/Sep/21 ]

Correct, I believe we unconditionally pass in dupsAllowed=false when inserting keys.

My waning memory tells me this might have changed with 2 phase index builds because we wanted secondaries to capture conflicts in the event they were promoted to primary and wanted to commit the index build. But I couldn't tell if we were using some different code path to have storage return possible conflicts.

Comment by Louis Williams [ 09/Sep/21 ]

daniel.gottlieb, are you seeing that secondaries are not passing dupsAllowed=true? Do you know why not?

Generated at Thu Feb 08 05:48:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.