[CDRIVER-3366] txn_opts_cleanup should reset max_commit_time_ms Created: 11/Sep/19 Updated: 28/Oct/23 Resolved: 06/Nov/19 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | Transactions |
| Affects Version/s: | 1.15.0 |
| Fix Version/s: | 1.15.2 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Jeremy Mikola | Assignee: | Andreas Braun |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
txn_opts_cleanup is called from the following places:
txn_opts_set is called from the following places:
txn_opts_set only assigns RC, WC, and RP if they are non-null. max_commit_time_ms is only assigned if it is not DEFAULT_MAX_COMMIT_TIME_MS, which is defined as zero. Since memory is zero-allocated, the initial options struct is correctly initialized with the default value for max_commit_time_ms. Since txn_opts_cleanup never resets max_commit_time_ms, I think it's possible for one transaction's max_commit_time_ms to bleed over to the next. Consider a case where one transaction specifies a non-zero max_commit_time_ms. That transaction ends (either committing or aborting). The next transaction starts and if the default transaction opts had no max_commit_time_ms (i.e. the default), txn_opts_set will leave the field as-is. I believe the correct fix for this is to have txn_opts_cleanup also reset max_commit_time_ms as it does the RC, WC, and RP pointers. It shouldn't be too hard to create a regression test for this as well. |
| Comments |
| Comment by Githook User [ 06/Nov/19 ] |
|
Author: {'username': 'alcaeus', 'email': 'git@alcaeus.org', 'name': 'Andreas Braun'}Message: |
| Comment by Githook User [ 06/Nov/19 ] |
|
Author: {'name': 'Andreas Braun', 'username': 'alcaeus', 'email': 'git@alcaeus.org'}Message: |