[SERVER-76775] Replace `iasserted` with `throw` in `throwWriteConflictException` Created: 02/May/23 Updated: 29/Oct/23 Resolved: 04/May/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 7.1.0-rc0, 7.0.0-rc1 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Amirsaman Memaripour | Assignee: | Amirsaman Memaripour |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Backport Requested: |
v7.0
|
||||||||
| Sprint: | Service Arch 2023-05-15 | ||||||||
| Participants: | |||||||||
| Linked BF Score: | 129 | ||||||||
| Description |
|
|
| Comments |
| Comment by Githook User [ 05/May/23 ] |
|
Author: {'name': 'Amirsaman Memaripour', 'email': 'amirsaman.memaripour@mongodb.com', 'username': 'samanca'}Message: (cherry picked from commit 4973d6f85a1a394aff14d4a2124ba993d666c604) |
| Comment by Githook User [ 04/May/23 ] |
|
Author: {'name': 'Amirsaman Memaripour', 'email': 'amirsaman.memaripour@mongodb.com', 'username': 'samanca'}Message: |
| Comment by Billy Donahue [ 03/May/23 ] |
|
ok thanks for the details. |
| Comment by Amirsaman Memaripour [ 03/May/23 ] |
Yes, for contended writes, the additional function calls add up to a 3-4% regression. I was able to verify this by replacing `iasserted` with `throw`.
I believe so, we throw WriteConflict exceptions and retry on them on the hot-path, they are not an exceptional event, hence my agreement with your statement that Exceptions are not the right tool to identify and handle write conflicts. On another note, the additional overhead can be mitigated with a simple change (this ticket), but rewriting the write-conflict path to rely on a new mechanism is not as trivial. |
| Comment by Billy Donahue [ 03/May/23 ] |
|
Any throw is going to be expensive in C++. It's just the way it is unfortunately. Is the real issue here that we're using exceptions to handle an expected occurrence (write conflicts)? |