Commit c00c7a8
committed
[yugabyte#25379] docdb: Introduce per-transaction LockTracker state
Summary:
The current LockTracker implementation for ObjectLockManager involves a multi-index
container uniquely keyed on (versioned_txn, subtxn_id, object_id) and additionally indexed on
various subsets of the unique key. This means that we have to acquire the global
mutex an additional time on lock acquire/release/wait/wakeup.
This diff refactors this map to instead be keyed on versioned_txn and point to a per-transaction
struct (TrackedTransactionLockEntry) which contains a further
subtxn_id => object_id => TrackedLockEntry mapping. This allows us to pass around this new
TrackedTransactionLockEntry and avoid the need for a repeated global mutex lock for LockTracker
functionality.
TrackedTransactionLockEntry is currently only briefly passed around through the lock acquire path
to avoid repeated global mutex locks; storing it externally to help avoid the need for the initial
global mutex lock will be addressed in a later diff.
This is also needed for the planned move of ObjectLockManager into shared memory, to avoid
partially updated indexes in the multi-index in event of PG crashing while inserting/deleting from
the container.
Jira: DB-14609
Test Plan: Jenkins.
Reviewers: bkolagani
Reviewed By: bkolagani
Subscribers: sergei, ybase
Differential Revision: https://phorge.dev.yugabyte.com/D408141 parent 73a7f12 commit c00c7a8
File tree
5 files changed
+268
-264
lines changed- src/yb
- docdb
- util
5 files changed
+268
-264
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | 41 | | |
51 | 42 | | |
52 | 43 | | |
53 | 44 | | |
54 | 45 | | |
55 | 46 | | |
56 | 47 | | |
| 48 | + | |
| 49 | + | |
57 | 50 | | |
58 | 51 | | |
59 | 52 | | |
| |||
66 | 59 | | |
67 | 60 | | |
68 | 61 | | |
| 62 | + | |
| 63 | + | |
69 | 64 | | |
70 | 65 | | |
71 | 66 | | |
72 | 67 | | |
73 | 68 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | 69 | | |
86 | 70 | | |
87 | 71 | | |
| |||
96 | 80 | | |
97 | 81 | | |
98 | 82 | | |
| 83 | + | |
| 84 | + | |
99 | 85 | | |
100 | 86 | | |
101 | 87 | | |
102 | 88 | | |
103 | 89 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | 90 | | |
0 commit comments