diff --git a/pkg/kv/kvserver/concurrency/concurrency_manager_test.go b/pkg/kv/kvserver/concurrency/concurrency_manager_test.go index 12fb8aadc7b5..7ee38f1cef9f 100644 --- a/pkg/kv/kvserver/concurrency/concurrency_manager_test.go +++ b/pkg/kv/kvserver/concurrency/concurrency_manager_test.go @@ -53,15 +53,15 @@ import ( // // new-txn name= ts=[,] epoch= [maxts=[,]] // new-request name= txn=|none ts=[,] [priority] [consistency] -// [=...] +// [=...] (hint: see scanSingleRequest) // sequence req= // finish req= // // handle-write-intent-error req= txn= key= // handle-txn-push-error req= txn= key= TODO(nvanbenschoten): implement this // -// on-lock-acquired txn= key= -// on-lock-updated txn= key= status=[committed|aborted|pending] [ts=[,]] +// on-lock-acquired req= key= +// on-lock-updated req= txn= key= status=[committed|aborted|pending] [ts=[,]] // on-txn-updated txn= status=[committed|aborted|pending] [ts=[,]] // // on-lease-updated leaseholder= @@ -136,8 +136,10 @@ func TestConcurrencyManagerBasic(t *testing.T) { } ts := scanTimestamp(t, d) - if txn != nil && txn.ReadTimestamp != ts { - d.Fatalf(t, "txn read timestamp != timestamp") + if txn != nil { + txn = txn.Clone() + txn.ReadTimestamp = ts + txn.WriteTimestamp = ts } readConsistency := roachpb.CONSISTENT @@ -149,7 +151,7 @@ func TestConcurrencyManagerBasic(t *testing.T) { var reqs []roachpb.Request singleReqLines := strings.Split(d.Input, "\n") for _, line := range singleReqLines { - req := scanSingleRequest(t, d, line) + req := scanSingleRequest(t, d, line, c.txnsByName) reqs = append(reqs, req) } reqUnions := make([]roachpb.RequestUnion, len(reqs)) @@ -257,18 +259,34 @@ func TestConcurrencyManagerBasic(t *testing.T) { return c.waitAndCollect(t, mon) case "on-lock-acquired": - var txnName string - d.ScanArgs(t, "txn", &txnName) - txn, ok := c.txnsByName[txnName] + var reqName string + d.ScanArgs(t, "req", &reqName) + guard, ok := c.guardsByReqName[reqName] if !ok { - d.Fatalf(t, "unknown txn %s", txnName) + d.Fatalf(t, "unknown request: %s", reqName) } + txn := guard.Req.Txn var key string d.ScanArgs(t, "key", &key) + // Confirm that the request has a corresponding write request. + found := false + for _, ru := range guard.Req.Requests { + req := ru.GetInner() + keySpan := roachpb.Span{Key: roachpb.Key(key)} + if roachpb.IsLocking(req) && + req.Header().Span().Contains(keySpan) { + found = true + break + } + } + if !found { + d.Fatalf(t, "missing corresponding write request") + } + mon.runSync("acquire lock", func(ctx context.Context) { - log.Eventf(ctx, "%s @ %s", txnName, key) + log.Eventf(ctx, "txn %s @ %s", txn.ID.Short(), key) span := roachpb.Span{Key: roachpb.Key(key)} up := roachpb.MakeLockUpdateWithDur(txn, span, lock.Unreplicated) m.OnLockAcquired(ctx, &up) @@ -276,6 +294,13 @@ func TestConcurrencyManagerBasic(t *testing.T) { return c.waitAndCollect(t, mon) case "on-lock-updated": + var reqName string + d.ScanArgs(t, "req", &reqName) + guard, ok := c.guardsByReqName[reqName] + if !ok { + d.Fatalf(t, "unknown request: %s", reqName) + } + var txnName string d.ScanArgs(t, "txn", &txnName) txn, ok := c.txnsByName[txnName] @@ -292,12 +317,27 @@ func TestConcurrencyManagerBasic(t *testing.T) { ts = scanTimestamp(t, d) } + // Confirm that the request has a corresponding ResolveIntent. + found := false + for _, ru := range guard.Req.Requests { + if riReq := ru.GetResolveIntent(); riReq != nil && + riReq.IntentTxn.ID == txn.ID && + riReq.Key.Equal(roachpb.Key(key)) && + riReq.Status == status { + found = true + break + } + } + if !found { + d.Fatalf(t, "missing corresponding resolve intent request") + } + txnUpdate := txn.Clone() txnUpdate.Status = status txnUpdate.WriteTimestamp.Forward(ts) mon.runSync("update lock", func(ctx context.Context) { - log.Eventf(ctx, "%s %s @ %s", verb, txnName, key) + log.Eventf(ctx, "%s txn %s @ %s", verb, txn.ID.Short(), key) span := roachpb.Span{Key: roachpb.Key(key)} up := roachpb.MakeLockUpdate(txnUpdate, span) m.OnLockUpdated(ctx, &up) diff --git a/pkg/kv/kvserver/concurrency/datadriven_util_test.go b/pkg/kv/kvserver/concurrency/datadriven_util_test.go index dba8c870197e..bdf0caea30c8 100644 --- a/pkg/kv/kvserver/concurrency/datadriven_util_test.go +++ b/pkg/kv/kvserver/concurrency/datadriven_util_test.go @@ -57,7 +57,9 @@ func scanTimestampWithName(t *testing.T, d *datadriven.TestData, name string) hl return ts } -func scanSingleRequest(t *testing.T, d *datadriven.TestData, line string) roachpb.Request { +func scanSingleRequest( + t *testing.T, d *datadriven.TestData, line string, txns map[string]*roachpb.Transaction, +) roachpb.Request { cmd, cmdArgs, err := datadriven.ParseLine(line) if err != nil { d.Fatalf(t, "error parsing single request: %v", err) @@ -100,6 +102,13 @@ func scanSingleRequest(t *testing.T, d *datadriven.TestData, line string) roachp r.Value.SetString(mustGetField("value")) return &r + case "resolve-intent": + var r roachpb.ResolveIntentRequest + r.IntentTxn = txns[mustGetField("txn")].TxnMeta + r.Key = roachpb.Key(mustGetField("key")) + r.Status = parseTxnStatus(t, d, mustGetField("status")) + return &r + case "request-lease": var r roachpb.RequestLeaseRequest return &r @@ -113,15 +122,31 @@ func scanSingleRequest(t *testing.T, d *datadriven.TestData, line string) roachp func scanTxnStatus(t *testing.T, d *datadriven.TestData) (roachpb.TransactionStatus, string) { var statusStr string d.ScanArgs(t, "status", &statusStr) - switch statusStr { + status := parseTxnStatus(t, d, statusStr) + var verb string + switch status { + case roachpb.COMMITTED: + verb = "committing" + case roachpb.ABORTED: + verb = "aborting" + case roachpb.PENDING: + verb = "increasing timestamp of" + default: + d.Fatalf(t, "unknown txn status: %s", status) + } + return status, verb +} + +func parseTxnStatus(t *testing.T, d *datadriven.TestData, s string) roachpb.TransactionStatus { + switch s { case "committed": - return roachpb.COMMITTED, "committing" + return roachpb.COMMITTED case "aborted": - return roachpb.ABORTED, "aborting" + return roachpb.ABORTED case "pending": - return roachpb.PENDING, "increasing timestamp of" + return roachpb.PENDING default: - d.Fatalf(t, "unknown txn statusStr: %s", statusStr) - return 0, "" + d.Fatalf(t, "unknown txn status: %s", s) + return 0 } } diff --git a/pkg/kv/kvserver/concurrency/testdata/concurrency_manager/basic b/pkg/kv/kvserver/concurrency/testdata/concurrency_manager/basic index 177cf23ab607..63a01c1e82ff 100644 --- a/pkg/kv/kvserver/concurrency/testdata/concurrency_manager/basic +++ b/pkg/kv/kvserver/concurrency/testdata/concurrency_manager/basic @@ -50,9 +50,9 @@ sequence req=req2 [1] sequence req2: scanning lock table for conflicting locks [1] sequence req2: sequencing complete, returned guard -on-lock-acquired txn=txn2 key=k +on-lock-acquired req=req2 key=k ---- -[-] acquire lock: txn2 @ k +[-] acquire lock: txn 00000002 @ k debug-lock-table ---- @@ -90,9 +90,20 @@ local: num=0 # 6. Requests proceed in order # ------------------------------------------------------------- -on-lock-acquired txn=txn2 key=k +sequence req=req2 ---- -[-] acquire lock: txn2 @ k +[1] sequence req2: sequencing request +[1] sequence req2: acquiring latches +[1] sequence req2: scanning lock table for conflicting locks +[1] sequence req2: sequencing complete, returned guard + +on-lock-acquired req=req2 key=k +---- +[-] acquire lock: txn 00000002 @ k + +finish req=req2 +---- +[-] finish req2: finishing request new-request name=req3 txn=txn3 ts=14,1 get key=k @@ -101,20 +112,20 @@ new-request name=req3 txn=txn3 ts=14,1 sequence req=req3 ---- -[1] sequence req3: sequencing request -[1] sequence req3: acquiring latches -[1] sequence req3: scanning lock table for conflicting locks -[1] sequence req3: waiting in lock wait-queues -[1] sequence req3: pushing timestamp of txn 00000002 above 0.000000014,1 -[1] sequence req3: blocked on select in concurrency_test.(*cluster).PushTransaction +[2] sequence req3: sequencing request +[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: pushing timestamp of txn 00000002 above 0.000000014,1 +[2] sequence req3: blocked on select in concurrency_test.(*cluster).PushTransaction on-txn-updated txn=txn2 status=committed ---- [-] update txn: committing txn2 -[1] sequence req3: resolving intent "k" for txn 00000002 with COMMITTED status -[1] sequence req3: acquiring latches -[1] sequence req3: scanning lock table for conflicting locks -[1] sequence req3: sequencing complete, returned guard +[2] sequence req3: resolving intent "k" for txn 00000002 with COMMITTED status +[2] sequence req3: acquiring latches +[2] sequence req3: scanning lock table for conflicting locks +[2] sequence req3: sequencing complete, returned guard debug-lock-table ---- @@ -127,9 +138,9 @@ new-request name=req4 txn=txn1 ts=10,1 sequence req=req4 ---- -[2] sequence req4: sequencing request -[2] sequence req4: acquiring latches -[2] sequence req4: blocked on select in spanlatch.(*Manager).waitForSignal +[3] sequence req4: sequencing request +[3] sequence req4: acquiring latches +[3] sequence req4: blocked on select in spanlatch.(*Manager).waitForSignal debug-latch-manager ---- @@ -139,8 +150,8 @@ write count: 1 finish req=req3 ---- [-] finish req3: finishing request -[2] sequence req4: scanning lock table for conflicting locks -[2] sequence req4: sequencing complete, returned guard +[3] sequence req4: scanning lock table for conflicting locks +[3] sequence req4: sequencing complete, returned guard finish req=req4 ---- @@ -160,9 +171,20 @@ reset # 8. Requests proceed in order # ------------------------------------------------------------- -on-lock-acquired txn=txn2 key=k +sequence req=req2 ---- -[-] acquire lock: txn2 @ k +[1] sequence req2: sequencing request +[1] sequence req2: acquiring latches +[1] sequence req2: scanning lock table for conflicting locks +[1] sequence req2: sequencing complete, returned guard + +on-lock-acquired req=req2 key=k +---- +[-] acquire lock: txn 00000002 @ k + +finish req=req2 +---- +[-] finish req2: finishing request new-request name=req5 txn=none ts=14,1 scan key=a endkey=m @@ -170,12 +192,12 @@ new-request name=req5 txn=none ts=14,1 sequence req=req5 ---- -[1] sequence req5: sequencing request -[1] sequence req5: acquiring latches -[1] sequence req5: scanning lock table for conflicting locks -[1] sequence req5: waiting in lock wait-queues -[1] sequence req5: pushing timestamp of txn 00000002 above 0.000000014,1 -[1] sequence req5: blocked on select in concurrency_test.(*cluster).PushTransaction +[2] sequence req5: sequencing request +[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: pushing timestamp of txn 00000002 above 0.000000014,1 +[2] sequence req5: blocked on select in concurrency_test.(*cluster).PushTransaction new-request name=req6 txn=none ts=16,1 scan key=c endkey=z @@ -183,22 +205,22 @@ new-request name=req6 txn=none ts=16,1 sequence req=req6 ---- -[2] sequence req6: sequencing request -[2] sequence req6: acquiring latches -[2] sequence req6: scanning lock table for conflicting locks -[2] sequence req6: waiting in lock wait-queues -[2] sequence req6: blocked on select in concurrency.(*lockTableWaiterImpl).WaitOn +[3] sequence req6: sequencing request +[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: blocked on select in concurrency.(*lockTableWaiterImpl).WaitOn on-txn-updated txn=txn2 status=pending ts=18,1 ---- [-] update txn: increasing timestamp of txn2 -[1] sequence req5: resolving intent "k" for txn 00000002 with PENDING status -[1] sequence req5: acquiring latches -[1] sequence req5: scanning lock table for conflicting locks -[1] sequence req5: sequencing complete, returned guard -[2] sequence req6: acquiring latches -[2] sequence req6: scanning lock table for conflicting locks -[2] sequence req6: sequencing complete, returned guard +[2] sequence req5: resolving intent "k" for txn 00000002 with PENDING status +[2] sequence req5: acquiring latches +[2] sequence req5: scanning lock table for conflicting locks +[2] sequence req5: sequencing complete, returned guard +[3] sequence req6: acquiring latches +[3] sequence req6: scanning lock table for conflicting locks +[3] sequence req6: sequencing complete, returned guard new-request name=req7 txn=none ts=12,1 put key=k value=v @@ -206,9 +228,9 @@ new-request name=req7 txn=none ts=12,1 sequence req=req7 ---- -[3] sequence req7: sequencing request -[3] sequence req7: acquiring latches -[3] sequence req7: blocked on select in spanlatch.(*Manager).waitForSignal +[4] sequence req7: sequencing request +[4] sequence req7: acquiring latches +[4] sequence req7: blocked on select in spanlatch.(*Manager).waitForSignal finish req=req5 ---- @@ -217,18 +239,18 @@ finish req=req5 finish req=req6 ---- [-] finish req6: finishing request -[3] sequence req7: scanning lock table for conflicting locks -[3] sequence req7: waiting in lock wait-queues -[3] sequence req7: pushing txn 00000002 to abort -[3] sequence req7: blocked on select in concurrency_test.(*cluster).PushTransaction +[4] sequence req7: scanning lock table for conflicting locks +[4] sequence req7: waiting in lock wait-queues +[4] sequence req7: pushing txn 00000002 to abort +[4] sequence req7: blocked on select in concurrency_test.(*cluster).PushTransaction on-txn-updated txn=txn2 status=committed ---- [-] update txn: committing txn2 -[3] sequence req7: resolving intent "k" for txn 00000002 with COMMITTED status -[3] sequence req7: acquiring latches -[3] sequence req7: scanning lock table for conflicting locks -[3] sequence req7: sequencing complete, returned guard +[4] sequence req7: resolving intent "k" for txn 00000002 with COMMITTED status +[4] sequence req7: acquiring latches +[4] sequence req7: scanning lock table for conflicting locks +[4] sequence req7: sequencing complete, returned guard finish req=req7 ---- diff --git a/pkg/kv/kvserver/concurrency/testdata/concurrency_manager/deadlocks b/pkg/kv/kvserver/concurrency/testdata/concurrency_manager/deadlocks index fdeac15a25cf..667acc2d8857 100644 --- a/pkg/kv/kvserver/concurrency/testdata/concurrency_manager/deadlocks +++ b/pkg/kv/kvserver/concurrency/testdata/concurrency_manager/deadlocks @@ -53,17 +53,17 @@ sequence req=req3w [3] sequence req3w: scanning lock table for conflicting locks [3] sequence req3w: sequencing complete, returned guard -on-lock-acquired txn=txn1 key=a +on-lock-acquired req=req1w key=a ---- -[-] acquire lock: txn1 @ a +[-] acquire lock: txn 00000001 @ a -on-lock-acquired txn=txn2 key=b +on-lock-acquired req=req2w key=b ---- -[-] acquire lock: txn2 @ b +[-] acquire lock: txn 00000002 @ b -on-lock-acquired txn=txn3 key=c +on-lock-acquired req=req3w key=c ---- -[-] acquire lock: txn3 @ c +[-] acquire lock: txn 00000003 @ c finish req=req1w ---- @@ -250,17 +250,17 @@ sequence req=req3w [3] sequence req3w: scanning lock table for conflicting locks [3] sequence req3w: sequencing complete, returned guard -on-lock-acquired txn=txn1 key=a +on-lock-acquired req=req1w key=a ---- -[-] acquire lock: txn1 @ a +[-] acquire lock: txn 00000001 @ a -on-lock-acquired txn=txn2 key=b +on-lock-acquired req=req2w key=b ---- -[-] acquire lock: txn2 @ b +[-] acquire lock: txn 00000002 @ b -on-lock-acquired txn=txn3 key=c +on-lock-acquired req=req3w key=c ---- -[-] acquire lock: txn3 @ c +[-] acquire lock: txn 00000003 @ c finish req=req1w ---- @@ -474,17 +474,17 @@ sequence req=req3w [3] sequence req3w: scanning lock table for conflicting locks [3] sequence req3w: sequencing complete, returned guard -on-lock-acquired txn=txn1 key=a +on-lock-acquired req=req1w key=a ---- -[-] acquire lock: txn1 @ a +[-] acquire lock: txn 00000001 @ a -on-lock-acquired txn=txn2 key=b +on-lock-acquired req=req2w key=b ---- -[-] acquire lock: txn2 @ b +[-] acquire lock: txn 00000002 @ b -on-lock-acquired txn=txn3 key=c +on-lock-acquired req=req3w key=c ---- -[-] acquire lock: txn3 @ c +[-] acquire lock: txn 00000003 @ c finish req=req1w ---- @@ -694,17 +694,17 @@ sequence req=req3w [3] sequence req3w: scanning lock table for conflicting locks [3] sequence req3w: sequencing complete, returned guard -on-lock-acquired txn=txn1 key=a +on-lock-acquired req=req1w key=a ---- -[-] acquire lock: txn1 @ a +[-] acquire lock: txn 00000001 @ a -on-lock-acquired txn=txn2 key=b +on-lock-acquired req=req2w key=b ---- -[-] acquire lock: txn2 @ b +[-] acquire lock: txn 00000002 @ b -on-lock-acquired txn=txn3 key=c +on-lock-acquired req=req3w key=c ---- -[-] acquire lock: txn3 @ c +[-] acquire lock: txn 00000003 @ c finish req=req1w ---- @@ -921,17 +921,17 @@ sequence req=req3w [3] sequence req3w: scanning lock table for conflicting locks [3] sequence req3w: sequencing complete, returned guard -on-lock-acquired txn=txn1 key=a +on-lock-acquired req=req1w key=a ---- -[-] acquire lock: txn1 @ a +[-] acquire lock: txn 00000001 @ a -on-lock-acquired txn=txn2 key=b +on-lock-acquired req=req2w key=b ---- -[-] acquire lock: txn2 @ b +[-] acquire lock: txn 00000002 @ b -on-lock-acquired txn=txn3 key=c +on-lock-acquired req=req3w key=c ---- -[-] acquire lock: txn3 @ c +[-] acquire lock: txn 00000003 @ c finish req=req1w ---- diff --git a/pkg/kv/kvserver/concurrency/testdata/concurrency_manager/range_state_listener b/pkg/kv/kvserver/concurrency/testdata/concurrency_manager/range_state_listener index 410289b1d21f..79c3ba43b5ad 100644 --- a/pkg/kv/kvserver/concurrency/testdata/concurrency_manager/range_state_listener +++ b/pkg/kv/kvserver/concurrency/testdata/concurrency_manager/range_state_listener @@ -61,13 +61,13 @@ sequence req=req1 [1] sequence req1: scanning lock table for conflicting locks [1] sequence req1: sequencing complete, returned guard -on-lock-acquired txn=txn1 key=k +on-lock-acquired req=req1 key=k ---- -[-] acquire lock: txn1 @ k +[-] acquire lock: txn 00000001 @ k -on-lock-acquired txn=txn1 key=k2 +on-lock-acquired req=req1 key=k2 ---- -[-] acquire lock: txn1 @ k2 +[-] acquire lock: txn 00000001 @ k2 finish req=req1 ---- @@ -160,9 +160,9 @@ sequence req=req2 [6] sequence req2: scanning lock table for conflicting locks [6] sequence req2: sequencing complete, returned guard -on-lock-acquired txn=txn2 key=k +on-lock-acquired req=req2 key=k ---- -[-] acquire lock: txn2 @ k +[-] acquire lock: txn 00000002 @ k debug-lock-table ---- @@ -221,10 +221,25 @@ global: num=1 distinguished req: 3 local: num=0 -on-lock-updated txn=txn2 key=k status=committed +new-request name=reqRes2 txn=none ts=10,1 + resolve-intent txn=txn2 key=k status=committed ---- -[-] update lock: committing txn2 @ k + +sequence req=reqRes2 +---- +[10] sequence reqRes2: sequencing request +[10] sequence reqRes2: acquiring latches +[10] sequence reqRes2: sequencing complete, returned guard + +on-lock-updated req=reqRes2 txn=txn2 key=k status=committed +---- +[-] update lock: committing txn 00000002 @ k [9] sequence req3: acquiring latches +[9] sequence req3: blocked on select in spanlatch.(*Manager).waitForSignal + +finish req=reqRes2 +---- +[-] finish reqRes2: finishing request [9] sequence req3: scanning lock table for conflicting locks [9] sequence req3: sequencing complete, returned guard @@ -235,9 +250,9 @@ global: num=1 res: req: 3, txn: 00000003-0000-0000-0000-000000000000, ts: 0.000000010,1, seq: 0 local: num=0 -on-lock-acquired txn=txn3 key=k +on-lock-acquired req=req3 key=k ---- -[-] acquire lock: txn3 @ k +[-] acquire lock: txn 00000003 @ k debug-lock-table ---- @@ -293,9 +308,9 @@ sequence req=req1 [1] sequence req1: scanning lock table for conflicting locks [1] sequence req1: sequencing complete, returned guard -on-lock-acquired txn=txn1 key=k +on-lock-acquired req=req1 key=k ---- -[-] acquire lock: txn1 @ k +[-] acquire lock: txn 00000001 @ k finish req=req1 ---- @@ -363,10 +378,25 @@ sequence req=req2 [4] sequence req2: waiting in lock wait-queues [4] sequence req2: blocked on select in concurrency.(*lockTableWaiterImpl).WaitOn -on-lock-updated txn=txn1 key=k status=committed +new-request name=reqRes1 txn=none ts=10,1 + resolve-intent txn=txn1 key=k status=committed +---- + +sequence req=reqRes1 +---- +[5] sequence reqRes1: sequencing request +[5] sequence reqRes1: acquiring latches +[5] sequence reqRes1: sequencing complete, returned guard + +on-lock-updated req=reqRes1 txn=txn1 key=k status=committed ---- -[-] update lock: committing txn1 @ k +[-] update lock: committing txn 00000001 @ k [4] sequence req2: acquiring latches +[4] sequence req2: blocked on select in spanlatch.(*Manager).waitForSignal + +finish req=reqRes1 +---- +[-] finish reqRes1: finishing request [4] sequence req2: scanning lock table for conflicting locks [4] sequence req2: sequencing complete, returned guard @@ -377,9 +407,9 @@ global: num=1 res: req: 5, txn: 00000002-0000-0000-0000-000000000000, ts: 0.000000010,1, seq: 0 local: num=0 -on-lock-acquired txn=txn2 key=k +on-lock-acquired req=req2 key=k ---- -[-] acquire lock: txn2 @ k +[-] acquire lock: txn 00000002 @ k debug-lock-table ---- @@ -439,13 +469,13 @@ sequence req=req1 [1] sequence req1: scanning lock table for conflicting locks [1] sequence req1: sequencing complete, returned guard -on-lock-acquired txn=txn1 key=k +on-lock-acquired req=req1 key=k ---- -[-] acquire lock: txn1 @ k +[-] acquire lock: txn 00000001 @ k -on-lock-acquired txn=txn1 key=k2 +on-lock-acquired req=req1 key=k2 ---- -[-] acquire lock: txn1 @ k2 +[-] acquire lock: txn 00000001 @ k2 finish req=req1 ---- @@ -537,9 +567,9 @@ sequence req=req2 [6] sequence req2: scanning lock table for conflicting locks [6] sequence req2: sequencing complete, returned guard -on-lock-acquired txn=txn2 key=k +on-lock-acquired req=req2 key=k ---- -[-] acquire lock: txn2 @ k +[-] acquire lock: txn 00000002 @ k debug-lock-table ---- @@ -593,9 +623,9 @@ sequence req=req1 [1] sequence req1: scanning lock table for conflicting locks [1] sequence req1: sequencing complete, returned guard -on-lock-acquired txn=txn1 key=k +on-lock-acquired req=req1 key=k ---- -[-] acquire lock: txn1 @ k +[-] acquire lock: txn 00000001 @ k finish req=req1 ---- @@ -663,10 +693,25 @@ sequence req=req2 [4] sequence req2: waiting in lock wait-queues [4] sequence req2: blocked on select in concurrency.(*lockTableWaiterImpl).WaitOn -on-lock-updated txn=txn1 key=k status=committed +new-request name=reqRes1 txn=none ts=10,1 + resolve-intent txn=txn1 key=k status=committed +---- + +sequence req=reqRes1 ---- -[-] update lock: committing txn1 @ k +[5] sequence reqRes1: sequencing request +[5] sequence reqRes1: acquiring latches +[5] sequence reqRes1: sequencing complete, returned guard + +on-lock-updated req=reqRes1 txn=txn1 key=k status=committed +---- +[-] update lock: committing txn 00000001 @ k [4] sequence req2: acquiring latches +[4] sequence req2: blocked on select in spanlatch.(*Manager).waitForSignal + +finish req=reqRes1 +---- +[-] finish reqRes1: finishing request [4] sequence req2: scanning lock table for conflicting locks [4] sequence req2: sequencing complete, returned guard @@ -677,9 +722,9 @@ global: num=1 res: req: 9, txn: 00000002-0000-0000-0000-000000000000, ts: 0.000000010,1, seq: 0 local: num=0 -on-lock-acquired txn=txn2 key=k +on-lock-acquired req=req2 key=k ---- -[-] acquire lock: txn2 @ k +[-] acquire lock: txn 00000002 @ k debug-lock-table ----