[CDRIVER-2379] Optimize txnNumber rewriting Created: 17/Nov/17  Updated: 07/Mar/23  Resolved: 07/Mar/23

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: bgtrack
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to CDRIVER-2386 Refactor findAndModify helper to use ... Backlog
related to CDRIVER-2387 Optimize access for retryWrites URI o... Backlog
is related to CDRIVER-2228 All writes retryable support Closed

 Description   

Each time we send a write command in a batch we must increment the value in its txnNumber field. I'd thought it was a good idea to keep a bson_iter_t permanently located at that field and use bson_iter_overwrite_int64 to increment the number, but something was wrong with that and it had to be reverted:

https://github.com/jmikola/mongo-c-driver/commit/c2dd0d4a5a69ef74adc01e2d3a0f879cf9c075f9

Investigate whether it's possible to avoid re-locating the txnNumber field for each command in the batch.



 Comments   
Comment by Rishabh Bisht [ 07/Mar/23 ]

Closing as per above comments.

Comment by Kevin Albertson [ 06/Mar/23 ]

This optimization only applies when a retry on error occurs. IMO this is not a significant enough optimization to investigate further.

Generated at Wed Feb 07 21:15:03 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.