[SERVER-51762] Delete code for old unique index format Created: 20/Oct/20  Updated: 22/Jan/24  Resolved: 15/Jan/21

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

Type: Improvement Priority: Major - P3
Reporter: Louis Williams Assignee: Louis Williams
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
Related
related to SERVER-75922 Partial unique indexes created on Mon... Closed
related to SERVER-85536 [4.4] removing unindexed unique parti... Closed
is related to SERVER-75922 Partial unique indexes created on Mon... Closed
Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2021-01-25
Participants:
Linked BF Score: 50

 Description   

All non-_id unique indexes since 4.4 should be upgraded to the new format versions 11 or 12. We already fatally assert if that is not the case.

  • Replace current checks for isTimestampSafeUniqueIdx with appropriate invariants on the format version
  • Delete all functions with the name "timestampUnsafe"


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

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-51762 Fix index building for ephemeralForTest
Branch: master
https://github.com/mongodb/mongo/commit/ab1ebf2353773101628de93855aa4cad3847c200

Comment by Githook User [ 15/Jan/21 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-51762 Delete code for old unique index format

This refactor makes the following improvements:

  • Deletes dead code that allows multiple RecordIds to coexist for the old unique
    index format
  • Deletes the obselete "trigger write conflict" code that applied to
    background indexes and has been superseded by hybrid indexes
  • Factors out three distinct implementations of indexes for WiredTiger:
    WiredTigerIndexStandard (non-unique indexes), WiredTigerIdIndex (_id
    index), and WiredTigerIndexUnique (non-_id unique indexes)
  • API modernization for the SortedDataInterface::BulkBuilder
    Branch: master
    https://github.com/mongodb/mongo/commit/e077301e21429fb9cd6f179fb0552336e39183bd
Comment by Louis Williams [ 20/Oct/20 ]

Code I think we can delete: In the function _insertTimestampUnsafe, for example, we can remove all of the code that handles WT_DUPLICATE_KEY errors highlighted here. Only _id indexes take this path, and I don't believe it's possible for _id indexes to temporarily have duplicate keys.

Code we can't delete: In _insertTimestampSafe, we can't remove any of the code that lazily upgrades the unique key format highlighted here. As you mentioned, this is because the new format (i.e. "timestamp safe") has to know how to read the old format.

Comment by Daniel Gottlieb (Inactive) [ 20/Oct/20 ]

Can you link to some of the old code that anticipates multiple record ids? Additional context for this ticket would be useful. It's my understanding that the new unique index format is a "superset" of the old format – it understands all of the old states an index could be in, but only writes out entries in the new format. And I would suspect we've already deleted the code that could write out the old-style entries when the FCV value gating the feature was deleted.

Comment by Louis Williams [ 20/Oct/20 ]

I actually don't think my assumption here is correct. _id indexes still take the "timestampUnsafe" code paths. That said, I believe we can still delete some of the code that anticipates there being multiple RecordIDs on the same key, since this should be impossible for the _id index.

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