[SERVER-32148] make NamespaceNotFound an acceptable error for emptyCapped and convertToCapped Created: 01/Dec/17  Updated: 30/Oct/23  Resolved: 31/Jul/18

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 3.4.17, 3.6.7, 4.0.2, 4.1.2

Type: Bug Priority: Major - P3
Reporter: Judah Schvimer Assignee: Siyuan Zhou
Resolution: Fixed Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.0, v3.6, v3.4
Sprint: Repl 2018-08-13
Participants:
Linked BF Score: 29

 Comments   
Comment by Githook User [ 14/Aug/18 ]

Author:

{'name': 'Chibuikem Amaechi', 'email': 'cramaechi@me.com', 'username': 'cramaechi'}

Message: SERVER-32148 Make NamespaceNotFound an acceptable error for emptyCapped and convertToCapped

Closes #1206

Signed-off-by: Siyuan Zhou <siyuan.zhou@mongodb.com>
(cherry picked from commit 35757e8ef3134fad1a09cb09a69882929d9ebb76)
Branch: v3.4
https://github.com/mongodb/mongo/commit/d0c7a5418e7759a6a85290660288631d802cdc38

Comment by Githook User [ 13/Aug/18 ]

Author:

{'name': 'Chibuikem Amaechi', 'email': 'cramaechi@me.com', 'username': 'cramaechi'}

Message: SERVER-32148 Make NamespaceNotFound an acceptable error for emptyCapped and convertToCapped

Closes #1206

Signed-off-by: Siyuan Zhou <siyuan.zhou@mongodb.com>
(cherry picked from commit 35757e8ef3134fad1a09cb09a69882929d9ebb76)
Branch: v3.6
https://github.com/mongodb/mongo/commit/4db65855dbdc64cd4ca97146c1b5b812e502c8e4

Comment by Githook User [ 13/Aug/18 ]

Author:

{'username': 'cramaechi', 'email': 'cramaechi@me.com', 'name': 'Chibuikem Amaechi'}

Message: SERVER-32148 Make NamespaceNotFound an acceptable error for emptyCapped and convertToCapped

Closes #1206

Signed-off-by: Siyuan Zhou <siyuan.zhou@mongodb.com>
(cherry picked from commit 35757e8ef3134fad1a09cb09a69882929d9ebb76)
Branch: v4.0
https://github.com/mongodb/mongo/commit/c42a6b4ca1c66cd200e2e61eb9a2a94494c5f2c0

Comment by Siyuan Zhou [ 01/Aug/18 ]

tess.avitabile, yes, I think this issue also exists on 3.6 and 3.4. We didn't change a lot in this area so it should be a clean backport mod some test changes.

Comment by Githook User [ 31/Jul/18 ]

Author:

{'username': 'cramaechi', 'name': 'Chibuikem Amaechi', 'email': 'cramaechi@me.com'}

Message: SERVER-32148 Make NamespaceNotFound an acceptable error for emptyCapped and convertToCapped

Closes #1206

Signed-off-by: Siyuan Zhou <siyuan.zhou@mongodb.com>
Branch: master
https://github.com/mongodb/mongo/commit/35757e8ef3134fad1a09cb09a69882929d9ebb76

Comment by Siyuan Zhou [ 26/Jan/18 ]

cramaechi, thanks for the pull request! I commented on it.

The format looks fine to me. I believe we need to ASSERT_OK() those commands can be applied correctly even if the collection doesn't exist. You were right that we need to change one more place. emptyCapped should uassert with ErrorCodes::NamespaceNotFound instead of the location number. Also uassert seems more consistent here than massert. Could you please update the pull request? I'd be happy to review the change.

Comment by Chibuikem Amaechi [ 24/Jan/18 ]

Hi Siyuan,

A pull request for this ticket has been opened.

I ran into a problem while running sync_tail_test.cpp with my two new test cases. Specifically, test case ConvertToCappedNamespaceNotFound failed due to ASSERT_NOT_OK() being used instead of ASSERT_OK().

I'm almost certain that the root cause of the error is the BSON command I constructed.

Comment by Chibuikem Amaechi [ 23/Jan/18 ]

Hi Siyuan - I will try to open a pull request by the end of today.

Thank you!

- Chibuikem. A

Comment by Siyuan Zhou [ 23/Jan/18 ]

Hi cramaechi, it would be great if you could make a pull request for this. Thanks!

After you make the change we discussed above, I'd suggest adding new tests cases for both commands in sync_tail_test.cpp. An example test case is this one. You may not want to createCollection() at the beginning, but the structure will probably look very similar. Beyond the returned result, you might also want to check the collection isn't created at all. An example of accessing database and collection is here. The code needs to check autoColl.getDb() and autoColl.getCollection() are both nullptr. Adding comments explaining the test cases is always appreciated.

Please let me know if you have any questions. Thanks again!

Comment by Spencer Brody (Inactive) [ 18/Jan/18 ]

I'm happy to take a pull request on this! Would be great to get this done without pulling away from our other development work too badly.
siyuan.zhou, can you point Chibuikem in the direction of the unit tests he would need to write/extend to test this change?

Comment by Chibuikem Amaechi [ 18/Jan/18 ]

Hi Siyuan,

Sounds good. I'll await your team's decision on how best to move forward with this ticket.

- Chibuikem. A

Comment by Siyuan Zhou [ 17/Jan/18 ]

Hi Chibuikem,

Great! I discussed this with our team, we believe the right solution is to add "NamespaceNotFound" as an acceptable error to ignore for secondary oplog application in oplog.cpp here.

ramon.fernandez and spencer, how do you want this ticket proceed? We can fix this directly or work on the pull request with Chibuikem.

Comment by Siyuan Zhou [ 17/Jan/18 ]

cramaechi, thanks for your comment and your interests in contribution!

Just to make things clear and to address your issues first. Did this issue happen to you? On primary or secondary? How did it happen? What version are you using?

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