[SERVER-35828] Check the readSource in dropCollection Created: 26/Jun/18  Updated: 24/Jan/19  Resolved: 24/Jan/19

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

Type: Bug Priority: Major - P3
Reporter: Xiangyu Yao (Inactive) Assignee: Xiangyu Yao (Inactive)
Resolution: Won't Fix Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-35804 Disallow dropping collections under c... Closed
Related
Operating System: ALL
Sprint: Storage NYC 2019-01-28
Participants:
Linked BF Score: 45

 Description   

In BF-9590, we could enter dropCollection() with kMajorityCommitted ReadSource since it's set previously by another command which used the same RecoveryUnit. Then, we read the on-disk index catalog with majorityCommitted timestamp and compare it with the in-memory one. If an index creation was just done after the majority committed point, the in-memory and the on-disk index catalog did not match.

I think we should assert that DropCollection() is performed with kUnset/kNoTimestamp ReadSource, or at least be aware that DropCollection() can be performed with other ReadSources. It would be useful to prevent bugs that arise from misusing the storage layer that are difficult and racy to diagnose.

Potential fixes:
1. Use AutoGetCollectionForRead in dropCollection() to get the collection. AutoGetCollectionForRead has the check for conflicting catalog changes. If the ReadSource is set to a majority timestamp which is less than MinVisibleSnapshotTimestamp, AutoGetCollectionForRead throws an exception and dropCollection() can retry.
2. Put an invariant "opCtx->RecoveryUnit()->getTimestampReadSource() == kUnset" in dropCollection.



 Comments   
Comment by Xiangyu Yao (Inactive) [ 24/Jan/19 ]

The invariant failed (BF-11843) due to the use of ConfigSvrDropCollectionCommand, indicating that SERVER-35804 is indeed still a problem. Since SERVER-35804 is in the sharding backlog, I am going to close this ticket as Won't Fix.

Comment by Eric Milkie [ 16/Jan/19 ]

Reverted to due to build failures.

Comment by Githook User [ 16/Jan/19 ]

Author:

{'username': 'milkie', 'email': 'milkie@10gen.com', 'name': 'Eric Milkie'}

Message: Revert "SERVER-35828 Check the readSource in dropCollection()"

This reverts commit 29efd5d05db9caab8c8812a83b6692e2e29b5f39.
Branch: master
https://github.com/mongodb/mongo/commit/e4e4d53329c475c0309b5bcf635214342d08d933

Comment by Githook User [ 14/Jan/19 ]

Author:

{'username': 'xy24', 'email': 'xiangyu.yao@mongodb.com', 'name': 'Xiangyu Yao'}

Message: SERVER-35828 Check the readSource in dropCollection()
Branch: master
https://github.com/mongodb/mongo/commit/29efd5d05db9caab8c8812a83b6692e2e29b5f39

Generated at Thu Feb 08 04:41:08 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.