Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

concurrency: s/queuedWriters/queuedLockingRequests/g #109454

Merged
merged 2 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
531 changes: 269 additions & 262 deletions pkg/kv/kvserver/concurrency/lock_table.go

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions pkg/kv/kvserver/concurrency/lock_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1941,13 +1941,13 @@ func TestCanElideWaitingStateUpdateConsidersAllFields(t *testing.T) {
doNotIncludeWhenDeciding inclusionStatus = false
)
fieldMap := map[string]inclusionStatus{
"kind": includeWhenDeciding,
"txn": includeWhenDeciding,
"key": includeWhenDeciding,
"held": includeWhenDeciding,
"queuedWriters": doNotIncludeWhenDeciding,
"queuedReaders": doNotIncludeWhenDeciding,
"guardStrength": doNotIncludeWhenDeciding,
"kind": includeWhenDeciding,
"txn": includeWhenDeciding,
"key": includeWhenDeciding,
"held": includeWhenDeciding,
"queuedLockingRequests": doNotIncludeWhenDeciding,
"queuedReaders": doNotIncludeWhenDeciding,
"guardStrength": doNotIncludeWhenDeciding,
}
ws := waitingState{}
typ := reflect.ValueOf(ws).Type()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ sequence req=req3
[2] sequence req3: acquiring latches
[2] sequence req3: scanning lock table for conflicting locks
[2] sequence req3: waiting in lock wait-queues
[2] sequence req3: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"k"› (queuedWriters: 0, queuedReaders: 1)
[2] sequence req3: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"k"› (queuedLockingRequests: 0, queuedReaders: 1)
[2] sequence req3: pushing after 0s for: liveness detection = true, deadlock detection = true, timeout enforcement = false, priority enforcement = false
[2] sequence req3: pushing timestamp of txn 00000002 above 14.000000000,1
[2] sequence req3: blocked on select in concurrency_test.(*cluster).PushTransaction
Expand Down Expand Up @@ -200,7 +200,7 @@ sequence req=req5
[2] sequence req5: acquiring latches
[2] sequence req5: scanning lock table for conflicting locks
[2] sequence req5: waiting in lock wait-queues
[2] sequence req5: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"k"› (queuedWriters: 0, queuedReaders: 1)
[2] sequence req5: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"k"› (queuedLockingRequests: 0, queuedReaders: 1)
[2] sequence req5: pushing after 0s for: liveness detection = true, deadlock detection = false, timeout enforcement = false, priority enforcement = false
[2] sequence req5: pushing timestamp of txn 00000002 above 14.000000000,1
[2] sequence req5: blocked on select in concurrency_test.(*cluster).PushTransaction
Expand All @@ -215,7 +215,7 @@ sequence req=req6
[3] sequence req6: acquiring latches
[3] sequence req6: scanning lock table for conflicting locks
[3] sequence req6: waiting in lock wait-queues
[3] sequence req6: lock wait-queue event: wait for txn 00000002 holding lock @ key ‹"k"› (queuedWriters: 0, queuedReaders: 2)
[3] sequence req6: lock wait-queue event: wait for txn 00000002 holding lock @ key ‹"k"› (queuedLockingRequests: 0, queuedReaders: 2)
[3] sequence req6: not pushing
[3] sequence req6: blocked on select in concurrency.(*lockTableWaiterImpl).WaitOn

Expand Down Expand Up @@ -259,7 +259,7 @@ finish req=req6
[-] finish req6: finishing request
[4] sequence req7: scanning lock table for conflicting locks
[4] sequence req7: waiting in lock wait-queues
[4] sequence req7: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"k"› (queuedWriters: 1, queuedReaders: 0)
[4] sequence req7: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"k"› (queuedLockingRequests: 1, queuedReaders: 0)
[4] sequence req7: pushing after 0s for: liveness detection = true, deadlock detection = false, timeout enforcement = false, priority enforcement = false
[4] sequence req7: pushing txn 00000002 to abort
[4] sequence req7: blocked on select in concurrency_test.(*cluster).PushTransaction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ sequence req=req1
[3] sequence req1: acquiring latches
[3] sequence req1: scanning lock table for conflicting locks
[3] sequence req1: waiting in lock wait-queues
[3] sequence req1: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"a"› (queuedWriters: 0, queuedReaders: 1)
[3] sequence req1: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"a"› (queuedLockingRequests: 0, queuedReaders: 1)
[3] sequence req1: pushing after 0s for: liveness detection = true, deadlock detection = true, timeout enforcement = false, priority enforcement = false
[3] sequence req1: pushing timestamp of txn 00000002 above 10.000000000,1
[3] sequence req1: blocked on select in concurrency_test.(*cluster).PushTransaction
Expand Down Expand Up @@ -165,7 +165,7 @@ debug-lock-table
num=1
lock: "a"
holder: txn: 00000002-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: false req: 2, strength: Intent, txn: 00000001-0000-0000-0000-000000000000

sequence req=req1
Expand All @@ -174,7 +174,7 @@ sequence req=req1
[3] sequence req1: acquiring latches
[3] sequence req1: scanning lock table for conflicting locks
[3] sequence req1: waiting in lock wait-queues
[3] sequence req1: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"a"› (queuedWriters: 1, queuedReaders: 0)
[3] sequence req1: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"a"› (queuedLockingRequests: 1, queuedReaders: 0)
[3] sequence req1: pushing after 0s for: liveness detection = true, deadlock detection = true, timeout enforcement = false, priority enforcement = false
[3] sequence req1: pushing txn 00000002 to abort
[3] sequence req1: blocked on select in concurrency_test.(*cluster).PushTransaction
Expand All @@ -201,11 +201,11 @@ debug-lock-table
----
num=2
lock: "a"
queued writers:
queued locking requests:
active: false req: 2, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "b"
holder: txn: 00000002-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl [holder finalized: committed]
queued writers:
queued locking requests:
active: false req: 2, strength: Intent, txn: 00000001-0000-0000-0000-000000000000

sequence req=req1
Expand All @@ -230,14 +230,14 @@ debug-lock-table
----
num=3
lock: "a"
queued writers:
queued locking requests:
active: false req: 2, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "b"
queued writers:
queued locking requests:
active: false req: 2, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "c"
holder: txn: 00000002-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl [holder finalized: committed]
queued writers:
queued locking requests:
active: false req: 2, strength: Intent, txn: 00000001-0000-0000-0000-000000000000

sequence req=req1
Expand All @@ -257,13 +257,13 @@ debug-lock-table
----
num=3
lock: "a"
queued writers:
queued locking requests:
active: false req: 2, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "b"
queued writers:
queued locking requests:
active: false req: 2, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "c"
queued writers:
queued locking requests:
active: false req: 2, strength: Intent, txn: 00000001-0000-0000-0000-000000000000

finish req=req1
Expand Down Expand Up @@ -352,7 +352,7 @@ sequence req=req1
[4] sequence req1: acquiring latches
[4] sequence req1: scanning lock table for conflicting locks
[4] sequence req1: waiting in lock wait-queues
[4] sequence req1: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"a"› (queuedWriters: 0, queuedReaders: 1)
[4] sequence req1: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"a"› (queuedLockingRequests: 0, queuedReaders: 1)
[4] sequence req1: pushing after 0s for: liveness detection = true, deadlock detection = true, timeout enforcement = false, priority enforcement = false
[4] sequence req1: pushing timestamp of txn 00000002 above 10.000000000,1
[4] sequence req1: blocked on select in concurrency_test.(*cluster).PushTransaction
Expand Down Expand Up @@ -450,15 +450,15 @@ debug-lock-table
num=3
lock: "c"
holder: txn: 00000003-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "d"
holder: txn: 00000003-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "e"
holder: txn: 00000005-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000

sequence req=req1
Expand All @@ -467,7 +467,7 @@ sequence req=req1
[3] sequence req1: acquiring latches
[3] sequence req1: scanning lock table for conflicting locks
[3] sequence req1: waiting in lock wait-queues
[3] sequence req1: lock wait-queue event: wait for (distinguished) txn 00000003 holding lock @ key ‹"c"› (queuedWriters: 1, queuedReaders: 0)
[3] sequence req1: lock wait-queue event: wait for (distinguished) txn 00000003 holding lock @ key ‹"c"› (queuedLockingRequests: 1, queuedReaders: 0)
[3] sequence req1: pushing after 0s for: liveness detection = true, deadlock detection = true, timeout enforcement = false, priority enforcement = false
[3] sequence req1: pushing txn 00000003 to abort
[3] sequence req1: blocked on select in concurrency_test.(*cluster).PushTransaction
Expand All @@ -477,16 +477,16 @@ debug-lock-table
num=3
lock: "c"
holder: txn: 00000003-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: true req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
distinguished req: 5
lock: "d"
holder: txn: 00000003-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "e"
holder: txn: 00000005-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000

new-request name=req3 txn=txn3 ts=10,1
Expand Down Expand Up @@ -536,16 +536,16 @@ num=5
holder: txn: 00000004-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: unrepl [(str: Exclusive seq: 0)]
lock: "c"
holder: txn: 00000003-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: true req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
distinguished req: 5
lock: "d"
holder: txn: 00000003-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "e"
holder: txn: 00000005-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000

new-request name=req2 txn=txn2 ts=11,1
Expand All @@ -559,7 +559,7 @@ sequence req=req2
[6] sequence req2: acquiring latches
[6] sequence req2: scanning lock table for conflicting locks
[6] sequence req2: waiting in lock wait-queues
[6] sequence req2: lock wait-queue event: wait for (distinguished) txn 00000003 holding lock @ key ‹"a"› (queuedWriters: 0, queuedReaders: 1)
[6] sequence req2: lock wait-queue event: wait for (distinguished) txn 00000003 holding lock @ key ‹"a"› (queuedLockingRequests: 0, queuedReaders: 1)
[6] sequence req2: pushing after 0s for: liveness detection = true, deadlock detection = true, timeout enforcement = false, priority enforcement = false
[6] sequence req2: pushing timestamp of txn 00000003 above 11.000000000,1
[6] sequence req2: blocked on select in concurrency_test.(*cluster).PushTransaction
Expand All @@ -576,16 +576,16 @@ num=5
holder: txn: 00000004-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: unrepl [(str: Exclusive seq: 0)]
lock: "c"
holder: txn: 00000003-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: true req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
distinguished req: 5
lock: "d"
holder: txn: 00000003-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "e"
holder: txn: 00000005-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000

debug-advance-clock ts=123
Expand All @@ -597,13 +597,13 @@ on-txn-updated txn=txn3 status=aborted
----
[-] update txn: aborting txn3
[3] sequence req1: resolving intent ‹"c"› for txn 00000003 with ABORTED status
[3] sequence req1: lock wait-queue event: wait for (distinguished) txn 00000005 holding lock @ key ‹"e"› (queuedWriters: 1, queuedReaders: 0)
[3] sequence req1: lock wait-queue event: wait for (distinguished) txn 00000005 holding lock @ key ‹"e"› (queuedLockingRequests: 1, queuedReaders: 0)
[3] sequence req1: conflicted with ‹00000003-0000-0000-0000-000000000000› on ‹"c"› for 123.000s
[3] sequence req1: pushing after 0s for: liveness detection = true, deadlock detection = true, timeout enforcement = false, priority enforcement = false
[3] sequence req1: pushing txn 00000005 to abort
[3] sequence req1: blocked on select in concurrency_test.(*cluster).PushTransaction
[6] sequence req2: resolving intent ‹"a"› for txn 00000003 with ABORTED status
[6] sequence req2: lock wait-queue event: wait for (distinguished) txn 00000004 holding lock @ key ‹"b"› (queuedWriters: 0, queuedReaders: 1)
[6] sequence req2: lock wait-queue event: wait for (distinguished) txn 00000004 holding lock @ key ‹"b"› (queuedLockingRequests: 0, queuedReaders: 1)
[6] sequence req2: conflicted with ‹00000003-0000-0000-0000-000000000000› on ‹"a"› for 123.000s
[6] sequence req2: pushing after 0s for: liveness detection = true, deadlock detection = true, timeout enforcement = false, priority enforcement = false
[6] sequence req2: pushing timestamp of txn 00000004 above 11.000000000,1
Expand All @@ -618,15 +618,15 @@ num=4
req: 8, txn: 00000002-0000-0000-0000-000000000000
distinguished req: 8
lock: "c"
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "d"
holder: txn: 00000003-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl [holder finalized: aborted]
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "e"
holder: txn: 00000005-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: true req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
distinguished req: 5

Expand All @@ -651,14 +651,14 @@ debug-lock-table
----
num=3
lock: "c"
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "d"
queued writers:
queued locking requests:
active: false req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
lock: "e"
holder: txn: 00000005-0000-0000-0000-000000000000 epoch: 0, iso: Serializable, ts: 10.000000000,1, info: repl
queued writers:
queued locking requests:
active: true req: 5, strength: Intent, txn: 00000001-0000-0000-0000-000000000000
distinguished req: 5

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ sequence req=req1
[3] sequence req1: acquiring latches
[3] sequence req1: scanning lock table for conflicting locks
[3] sequence req1: waiting in lock wait-queues
[3] sequence req1: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"a"› (queuedWriters: 0, queuedReaders: 1)
[3] sequence req1: lock wait-queue event: wait for (distinguished) txn 00000002 holding lock @ key ‹"a"› (queuedLockingRequests: 0, queuedReaders: 1)
[3] sequence req1: pushing after 0s for: liveness detection = true, deadlock detection = true, timeout enforcement = false, priority enforcement = false
[3] sequence req1: pushing timestamp of txn 00000002 above 10.000000000,1
[3] sequence req1: blocked on select in concurrency_test.(*cluster).PushTransaction
Expand Down
Loading
Loading