[SERVER-81508] Potential double-execution of write statements when ShardCannotRefreshDueToLocksHeld is thrown Created: 27/Sep/23  Updated: 11/Jan/24  Resolved: 16/Nov/23

Status: Closed
Project: Core Server
Component/s: Sharding, Write Ops
Affects Version/s: 5.0.0, 6.0.0, 7.0.0, 7.1.0-rc3
Fix Version/s: 7.2.1, 7.3.0-rc0, 7.1.2, 7.0.6, 5.0.25, 6.0.14

Type: Bug Priority: Major - P3
Reporter: Lingzhi Deng Assignee: Paolo Polato
Resolution: Fixed Votes: 0
Labels: shardingemea-qw
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File SERVER-81508.repro.patch    
Issue Links:
Backports
Related
is related to SERVER-54020 ShardInvalidatedForTargeting thrown b... Closed
Assigned Teams:
Sharding EMEA
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v7.2, v7.1, v7.0, v6.0, v5.0
Sprint: Sharding EMEA 2023-10-16, Sharding EMEA 2023-10-30, CAR Team 2023-11-13, CAR Team 2023-11-27
Participants:
Story Points: 2

 Description   

Write commands currently throw ShardCannotRefreshDueToLocksHeld as a top-level command error (i.e. ok: 0 with ShardCannotRefreshDueToLocksHeld). Additionally, mongos/shard may retry a command upon ShardCannotRefreshDueToLocksHeld error. And this is problematic if refreshing the cache fails with ShardCannotRefreshDueToLocksHeld in between write statements (e.g. flushRouterConfig is a user-facing command which could cause the CatalogCache to become stale for the temporary resharding collection). This is because some write statements may have been done before ShardCannotRefreshDueToLocksHeld was thrown and retrying the entire command may cause double execution for those write statements.



 Comments   
Comment by Githook User [ 11/Jan/24 ]

Author:

{'name': 'Paolo Polato', 'email': 'paolo.polato@mongodb.com', 'username': 'ppolato'}

Message: SERVER-81508 Avoid double execution of write statements when ShardCannotRefreshDueToLocksHeld is thrown.

(cherry picked from commit e175711195ce55401a2833dfbc30ee515599a2bc)
(cherry picked from commit c0aa44439617e549df55d4b3bb06c2e7af68f3b5)
(cherry picked from commit ba9e3277b29b52bf8003a79696f9af9571e765ba)

GitOrigin-RevId: 523bc79834ccd2741627e1247c18e33482e58ae0
Branch: v5.0
https://github.com/mongodb/mongo/commit/59613bd614abdba6d134ab40338dcc4a64f9166c

Comment by Githook User [ 10/Jan/24 ]

Author:

{'name': 'Paolo Polato', 'email': 'paolo.polato@mongodb.com', 'username': 'ppolato'}

Message: SERVER-81508 Avoid double execution of write statements when ShardCannotRefreshDueToLocksHeld is thrown.

(cherry picked from commit e175711195ce55401a2833dfbc30ee515599a2bc)
(cherry picked from commit c0aa44439617e549df55d4b3bb06c2e7af68f3b5)

GitOrigin-RevId: ba9e3277b29b52bf8003a79696f9af9571e765ba
Branch: v6.0
https://github.com/mongodb/mongo/commit/9ab048518c9cf6f3960dc39bbd6ee586b96d0484

Comment by Githook User [ 08/Jan/24 ]

Author:

{'name': 'Paolo Polato', 'email': 'paolo.polato@mongodb.com', 'username': 'ppolato'}

Message: SERVER-81508 Avoid double execution of write statements when ShardCannotRefreshDueToLocksHeld is thrown.

(cherry picked from commit e175711195ce55401a2833dfbc30ee515599a2bc)

GitOrigin-RevId: c0aa44439617e549df55d4b3bb06c2e7af68f3b5
Branch: v7.0
https://github.com/mongodb/mongo/commit/856896c448d3cb8867eb2bd90d0b58159a18f799

Comment by Githook User [ 08/Jan/24 ]

Author:

{'name': 'Paolo Polato', 'email': 'paolo.polato@mongodb.com', 'username': 'ppolato'}

Message: SERVER-81508 Avoid double execution of write statements when ShardCannotRefreshDueToLocksHeld is thrown.

(cherry picked from commit bec596c52e0c524fe835eac39c47d6db831e0493)
Branch: v7.2
https://github.com/mongodb/mongo/commit/38498d0d5adc78c8b31b1b0f3a704b538e85e5c1

Comment by Githook User [ 19/Dec/23 ]

Author:

{'name': 'Paolo Polato', 'email': 'paolo.polato@mongodb.com', 'username': 'ppolato'}

Message: SERVER-81508 Avoid double execution of write statements when ShardCannotRefreshDueToLocksHeld is thrown.

(cherry picked from commit bec596c52e0c524fe835eac39c47d6db831e0493)
Branch: v7.1
https://github.com/mongodb/mongo/commit/e175711195ce55401a2833dfbc30ee515599a2bc

Comment by Githook User [ 15/Nov/23 ]

Author:

{'name': 'Paolo Polato', 'email': 'paolo.polato@mongodb.com', 'username': 'ppolato'}

Message: SERVER-81508 Avoid double execution of write statements when ShardCannotRefreshDueToLocksHeld is thrown.
Branch: master
https://github.com/mongodb/mongo/commit/bec596c52e0c524fe835eac39c47d6db831e0493

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