github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/kv/kvserver/concurrency/testdata/lock_table/dup_access (about)

     1  # Tests where the same key is in both ReadWrite and ReadOnly spans.
     2  
     3  new-lock-table maxlocks=10000
     4  ----
     5  
     6  # ---------------------------------------------------------------------------------
     7  # Test: req2 accesses "a" as both write and read. Once it has reservation for write
     8  # it does not wait at "a" for read.
     9  # ---------------------------------------------------------------------------------
    10  
    11  new-txn txn=txn1 ts=10 epoch=0
    12  ----
    13  
    14  new-txn txn=txn2 ts=10 epoch=0
    15  ----
    16  
    17  new-txn txn=txn3 ts=10 epoch=0
    18  ----
    19  
    20  new-request r=req1 txn=txn1 ts=10 spans=w@a+w@b+w@c
    21  ----
    22  
    23  scan r=req1
    24  ----
    25  start-waiting: false
    26  
    27  acquire r=req1 k=a durability=u
    28  ----
    29  global: num=1
    30   lock: "a"
    31    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
    32  local: num=0
    33  
    34  dequeue r=req1
    35  ----
    36  global: num=1
    37   lock: "a"
    38    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
    39  local: num=0
    40  
    41  new-request r=req2 txn=txn2 ts=10 spans=w@a+r@a
    42  ----
    43  
    44  scan r=req2
    45  ----
    46  start-waiting: true
    47  
    48  guard-state r=req2
    49  ----
    50  new: state=waitForDistinguished txn=txn1 key="a" held=true guard-access=write
    51  
    52  print
    53  ----
    54  global: num=1
    55   lock: "a"
    56    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
    57     queued writers:
    58      active: true req: 2, txn: 00000000-0000-0000-0000-000000000002
    59     distinguished req: 2
    60  local: num=0
    61  
    62  release txn=txn1 span=a
    63  ----
    64  global: num=1
    65   lock: "a"
    66    res: req: 2, txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, seq: 0
    67  local: num=0
    68  
    69  guard-state r=req2
    70  ----
    71  new: state=doneWaiting
    72  
    73  dequeue r=req2
    74  ----
    75  global: num=0
    76  local: num=0
    77  
    78  # ---------------------------------------------------------------------------------
    79  # Test: req5 accesses "b" as both write and read. It has its reservation at "b"
    80  # broken, but ignores "b" when encounters it as reader.
    81  # ---------------------------------------------------------------------------------
    82  
    83  new-request r=req3 txn=txn1 ts=10 spans=w@a+w@b+w@c
    84  ----
    85  
    86  scan r=req3
    87  ----
    88  start-waiting: false
    89  
    90  acquire r=req3 k=a durability=u
    91  ----
    92  global: num=1
    93   lock: "a"
    94    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
    95  local: num=0
    96  
    97  acquire r=req3 k=b durability=u
    98  ----
    99  global: num=2
   100   lock: "a"
   101    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   102   lock: "b"
   103    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   104  local: num=0
   105  
   106  acquire r=req3 k=c durability=u
   107  ----
   108  global: num=3
   109   lock: "a"
   110    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   111   lock: "b"
   112    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   113   lock: "c"
   114    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   115  local: num=0
   116  
   117  dequeue r=req3
   118  ----
   119  global: num=3
   120   lock: "a"
   121    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   122   lock: "b"
   123    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   124   lock: "c"
   125    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   126  local: num=0
   127  
   128  new-request r=req4 txn=txn2 ts=10 spans=w@a+w@b
   129  ----
   130  
   131  scan r=req4
   132  ----
   133  start-waiting: true
   134  
   135  guard-state r=req4
   136  ----
   137  new: state=waitForDistinguished txn=txn1 key="a" held=true guard-access=write
   138  
   139  new-request r=req5 txn=txn3 ts=10 spans=w@b+w@c+r@b
   140  ----
   141  
   142  scan r=req5
   143  ----
   144  start-waiting: true
   145  
   146  guard-state r=req5
   147  ----
   148  new: state=waitForDistinguished txn=txn1 key="b" held=true guard-access=write
   149  
   150  print
   151  ----
   152  global: num=3
   153   lock: "a"
   154    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   155     queued writers:
   156      active: true req: 4, txn: 00000000-0000-0000-0000-000000000002
   157     distinguished req: 4
   158   lock: "b"
   159    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   160     queued writers:
   161      active: true req: 5, txn: 00000000-0000-0000-0000-000000000003
   162     distinguished req: 5
   163   lock: "c"
   164    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   165  local: num=0
   166  
   167  # req5 reserves "b" and waits at "c".
   168  
   169  release txn=txn1 span=b
   170  ----
   171  global: num=3
   172   lock: "a"
   173    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   174     queued writers:
   175      active: true req: 4, txn: 00000000-0000-0000-0000-000000000002
   176     distinguished req: 4
   177   lock: "b"
   178    res: req: 5, txn: 00000000-0000-0000-0000-000000000003, ts: 0.000000010,0, seq: 0
   179   lock: "c"
   180    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   181  local: num=0
   182  
   183  guard-state r=req5
   184  ----
   185  new: state=waitForDistinguished txn=txn1 key="c" held=true guard-access=write
   186  
   187  print
   188  ----
   189  global: num=3
   190   lock: "a"
   191    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   192     queued writers:
   193      active: true req: 4, txn: 00000000-0000-0000-0000-000000000002
   194     distinguished req: 4
   195   lock: "b"
   196    res: req: 5, txn: 00000000-0000-0000-0000-000000000003, ts: 0.000000010,0, seq: 0
   197   lock: "c"
   198    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   199     queued writers:
   200      active: true req: 5, txn: 00000000-0000-0000-0000-000000000003
   201     distinguished req: 5
   202  local: num=0
   203  
   204  # req4 breaks the reservation of req4 at "b".
   205  
   206  release txn=txn1 span=a
   207  ----
   208  global: num=3
   209   lock: "a"
   210    res: req: 4, txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, seq: 0
   211   lock: "b"
   212    res: req: 5, txn: 00000000-0000-0000-0000-000000000003, ts: 0.000000010,0, seq: 0
   213   lock: "c"
   214    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   215     queued writers:
   216      active: true req: 5, txn: 00000000-0000-0000-0000-000000000003
   217     distinguished req: 5
   218  local: num=0
   219  
   220  guard-state r=req4
   221  ----
   222  new: state=doneWaiting
   223  
   224  print
   225  ----
   226  global: num=3
   227   lock: "a"
   228    res: req: 4, txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, seq: 0
   229   lock: "b"
   230    res: req: 4, txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, seq: 0
   231     queued writers:
   232      active: false req: 5, txn: 00000000-0000-0000-0000-000000000003
   233   lock: "c"
   234    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   235     queued writers:
   236      active: true req: 5, txn: 00000000-0000-0000-0000-000000000003
   237     distinguished req: 5
   238  local: num=0
   239  
   240  # req5 encounters the reservation by req4 at "b" when looking at it for its read access, but ignores
   241  # it.
   242  release txn=txn1 span=c
   243  ----
   244  global: num=3
   245   lock: "a"
   246    res: req: 4, txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, seq: 0
   247   lock: "b"
   248    res: req: 4, txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, seq: 0
   249     queued writers:
   250      active: false req: 5, txn: 00000000-0000-0000-0000-000000000003
   251   lock: "c"
   252    res: req: 5, txn: 00000000-0000-0000-0000-000000000003, ts: 0.000000010,0, seq: 0
   253  local: num=0
   254  
   255  guard-state r=req5
   256  ----
   257  new: state=doneWaiting
   258  
   259  scan r=req5
   260  ----
   261  start-waiting: true
   262  
   263  print
   264  ----
   265  global: num=3
   266   lock: "a"
   267    res: req: 4, txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, seq: 0
   268   lock: "b"
   269    res: req: 4, txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, seq: 0
   270     queued writers:
   271      active: true req: 5, txn: 00000000-0000-0000-0000-000000000003
   272     distinguished req: 5
   273   lock: "c"
   274    res: req: 5, txn: 00000000-0000-0000-0000-000000000003, ts: 0.000000010,0, seq: 0
   275  local: num=0
   276  
   277  dequeue r=req4
   278  ----
   279  global: num=2
   280   lock: "b"
   281    res: req: 5, txn: 00000000-0000-0000-0000-000000000003, ts: 0.000000010,0, seq: 0
   282   lock: "c"
   283    res: req: 5, txn: 00000000-0000-0000-0000-000000000003, ts: 0.000000010,0, seq: 0
   284  local: num=0
   285  
   286  dequeue r=req5
   287  ----
   288  global: num=0
   289  local: num=0
   290  
   291  print
   292  ----
   293  global: num=0
   294  local: num=0
   295  
   296  # ---------------------------------------------------------------------------------
   297  # Test: Non-transactional req8 accesses "b" as both write and read. After it has stopped waiting
   298  # at "b", the reservation for "b" is acquired by a request with a lower seqnum. req8 does not ignore
   299  # "b" when encountering it as a reader. This is the non-transactional request version of the
   300  # previous test.
   301  # ---------------------------------------------------------------------------------
   302  
   303  new-request r=req6 txn=txn1 ts=10 spans=w@a+w@b+w@c
   304  ----
   305  
   306  scan r=req6
   307  ----
   308  start-waiting: false
   309  
   310  acquire r=req6 k=a durability=u
   311  ----
   312  global: num=1
   313   lock: "a"
   314    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   315  local: num=0
   316  
   317  acquire r=req6 k=b durability=u
   318  ----
   319  global: num=2
   320   lock: "a"
   321    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   322   lock: "b"
   323    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   324  local: num=0
   325  
   326  acquire r=req6 k=c durability=u
   327  ----
   328  global: num=3
   329   lock: "a"
   330    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   331   lock: "b"
   332    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   333   lock: "c"
   334    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   335  local: num=0
   336  
   337  dequeue r=req6
   338  ----
   339  global: num=3
   340   lock: "a"
   341    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   342   lock: "b"
   343    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   344   lock: "c"
   345    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   346  local: num=0
   347  
   348  new-request r=req7 txn=txn2 ts=10 spans=w@a+w@b
   349  ----
   350  
   351  scan r=req7
   352  ----
   353  start-waiting: true
   354  
   355  guard-state r=req7
   356  ----
   357  new: state=waitForDistinguished txn=txn1 key="a" held=true guard-access=write
   358  
   359  new-request r=req8 txn=none ts=10 spans=w@b+w@c+r@b
   360  ----
   361  
   362  scan r=req8
   363  ----
   364  start-waiting: true
   365  
   366  guard-state r=req8
   367  ----
   368  new: state=waitForDistinguished txn=txn1 key="b" held=true guard-access=write
   369  
   370  # req9 is just to prevent the lock for "b" from being gc'd and then a new one
   371  # created when req7 acquires "b", which due to the old snapshot held by req8
   372  # would not be seen until the next scan.
   373  new-request r=req9 txn=txn2 ts=10 spans=w@b
   374  ----
   375  
   376  scan r=req9
   377  ----
   378  start-waiting: true
   379  
   380  guard-state r=req9
   381  ----
   382  new: state=waitFor txn=txn1 key="b" held=true guard-access=write
   383  
   384  print
   385  ----
   386  global: num=3
   387   lock: "a"
   388    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   389     queued writers:
   390      active: true req: 7, txn: 00000000-0000-0000-0000-000000000002
   391     distinguished req: 7
   392   lock: "b"
   393    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   394     queued writers:
   395      active: true req: 8, txn: none
   396      active: true req: 9, txn: 00000000-0000-0000-0000-000000000002
   397     distinguished req: 8
   398   lock: "c"
   399    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   400  local: num=0
   401  
   402  # req8 waits at "c".
   403  
   404  release txn=txn1 span=b
   405  ----
   406  global: num=3
   407   lock: "a"
   408    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   409     queued writers:
   410      active: true req: 7, txn: 00000000-0000-0000-0000-000000000002
   411     distinguished req: 7
   412   lock: "b"
   413    res: req: 9, txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, seq: 0
   414   lock: "c"
   415    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   416  local: num=0
   417  
   418  guard-state r=req8
   419  ----
   420  new: state=waitForDistinguished txn=txn1 key="c" held=true guard-access=write
   421  
   422  print
   423  ----
   424  global: num=3
   425   lock: "a"
   426    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   427     queued writers:
   428      active: true req: 7, txn: 00000000-0000-0000-0000-000000000002
   429     distinguished req: 7
   430   lock: "b"
   431    res: req: 9, txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, seq: 0
   432   lock: "c"
   433    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   434     queued writers:
   435      active: true req: 8, txn: none
   436     distinguished req: 8
   437  local: num=0
   438  
   439  # req7 is doneWaiting and proceeds to acquire the lock at "b".
   440  
   441  release txn=txn1 span=a
   442  ----
   443  global: num=3
   444   lock: "a"
   445    res: req: 7, txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, seq: 0
   446   lock: "b"
   447    res: req: 9, txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, seq: 0
   448   lock: "c"
   449    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   450     queued writers:
   451      active: true req: 8, txn: none
   452     distinguished req: 8
   453  local: num=0
   454  
   455  guard-state r=req7
   456  ----
   457  new: state=doneWaiting
   458  
   459  print
   460  ----
   461  global: num=3
   462   lock: "a"
   463    res: req: 7, txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, seq: 0
   464   lock: "b"
   465    res: req: 7, txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, seq: 0
   466     queued writers:
   467      active: false req: 9, txn: 00000000-0000-0000-0000-000000000002
   468   lock: "c"
   469    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   470     queued writers:
   471      active: true req: 8, txn: none
   472     distinguished req: 8
   473  local: num=0
   474  
   475  scan r=req7
   476  ----
   477  start-waiting: false
   478  
   479  acquire r=req7 k=b durability=u
   480  ----
   481  global: num=3
   482   lock: "a"
   483    res: req: 7, txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, seq: 0
   484   lock: "b"
   485    holder: txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   486   lock: "c"
   487    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   488     queued writers:
   489      active: true req: 8, txn: none
   490     distinguished req: 8
   491  local: num=0
   492  
   493  # req8 encounters the lock held by req7 at "b" when looking at it for its read access.
   494  release txn=txn1 span=c
   495  ----
   496  global: num=2
   497   lock: "a"
   498    res: req: 7, txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, seq: 0
   499   lock: "b"
   500    holder: txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   501  local: num=0
   502  
   503  guard-state r=req8
   504  ----
   505  new: state=waitForDistinguished txn=txn2 key="b" held=true guard-access=read
   506  
   507  print
   508  ----
   509  global: num=2
   510   lock: "a"
   511    res: req: 7, txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, seq: 0
   512   lock: "b"
   513    holder: txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   514     waiting readers:
   515      req: 8, txn: none
   516     distinguished req: 8
   517  local: num=0
   518  
   519  dequeue r=req7
   520  ----
   521  global: num=1
   522   lock: "b"
   523    holder: txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   524     waiting readers:
   525      req: 8, txn: none
   526     distinguished req: 8
   527  local: num=0
   528  
   529  dequeue r=req8
   530  ----
   531  global: num=1
   532   lock: "b"
   533    holder: txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   534  local: num=0
   535  
   536  release txn=txn2 span=b
   537  ----
   538  global: num=0
   539  local: num=0
   540  
   541  # ---------------------------------------------------------------------------------
   542  # Test: req12 accesses "b" as both write and read. It has its reservation at "b"
   543  # broken, and the lock is acquired at "b" before it encounters "b" as reader, but
   544  # it ignores the lock at "b".
   545  # ---------------------------------------------------------------------------------
   546  
   547  new-request r=req10 txn=txn1 ts=10 spans=w@a+w@b
   548  ----
   549  
   550  scan r=req10
   551  ----
   552  start-waiting: false
   553  
   554  acquire r=req10 k=a durability=u
   555  ----
   556  global: num=1
   557   lock: "a"
   558    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   559  local: num=0
   560  
   561  acquire r=req10 k=b durability=u
   562  ----
   563  global: num=2
   564   lock: "a"
   565    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   566   lock: "b"
   567    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   568  local: num=0
   569  
   570  dequeue r=req10
   571  ----
   572  global: num=2
   573   lock: "a"
   574    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   575   lock: "b"
   576    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   577  local: num=0
   578  
   579  new-request r=req11 txn=txn2 ts=10 spans=w@a+w@b
   580  ----
   581  
   582  scan r=req11
   583  ----
   584  start-waiting: true
   585  
   586  guard-state r=req11
   587  ----
   588  new: state=waitForDistinguished txn=txn1 key="a" held=true guard-access=write
   589  
   590  new-request r=req12 txn=txn3 ts=10 spans=w@b+r@b
   591  ----
   592  
   593  scan r=req12
   594  ----
   595  start-waiting: true
   596  
   597  guard-state r=req12
   598  ----
   599  new: state=waitForDistinguished txn=txn1 key="b" held=true guard-access=write
   600  
   601  print
   602  ----
   603  global: num=2
   604   lock: "a"
   605    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   606     queued writers:
   607      active: true req: 11, txn: 00000000-0000-0000-0000-000000000002
   608     distinguished req: 11
   609   lock: "b"
   610    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   611     queued writers:
   612      active: true req: 12, txn: 00000000-0000-0000-0000-000000000003
   613     distinguished req: 12
   614  local: num=0
   615  
   616  # req12 reserves "b".
   617  
   618  release txn=txn1 span=b
   619  ----
   620  global: num=2
   621   lock: "a"
   622    holder: txn: 00000000-0000-0000-0000-000000000001, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   623     queued writers:
   624      active: true req: 11, txn: 00000000-0000-0000-0000-000000000002
   625     distinguished req: 11
   626   lock: "b"
   627    res: req: 12, txn: 00000000-0000-0000-0000-000000000003, ts: 0.000000010,0, seq: 0
   628  local: num=0
   629  
   630  # req11 reserves "a"
   631  release txn=txn1 span=a
   632  ----
   633  global: num=2
   634   lock: "a"
   635    res: req: 11, txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, seq: 0
   636   lock: "b"
   637    res: req: 12, txn: 00000000-0000-0000-0000-000000000003, ts: 0.000000010,0, seq: 0
   638  local: num=0
   639  
   640  # req11 breaks the reservation at "b"
   641  guard-state r=req11
   642  ----
   643  new: state=doneWaiting
   644  
   645  print
   646  ----
   647  global: num=2
   648   lock: "a"
   649    res: req: 11, txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, seq: 0
   650   lock: "b"
   651    res: req: 11, txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, seq: 0
   652     queued writers:
   653      active: false req: 12, txn: 00000000-0000-0000-0000-000000000003
   654  local: num=0
   655  
   656  scan r=req11
   657  ----
   658  start-waiting: false
   659  
   660  acquire r=req11 k=b durability=u
   661  ----
   662  global: num=2
   663   lock: "a"
   664    res: req: 11, txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, seq: 0
   665   lock: "b"
   666    holder: txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   667     queued writers:
   668      active: false req: 12, txn: 00000000-0000-0000-0000-000000000003
   669  local: num=0
   670  
   671  # req12 ignores the lock at "b" when it encounters it again as a reader. So it will
   672  # enter the doneWaiting state. It will wait again when it rescans.
   673  
   674  guard-state r=req12
   675  ----
   676  new: state=doneWaiting
   677  
   678  scan r=req12
   679  ----
   680  start-waiting: true
   681  
   682  guard-state r=req12
   683  ----
   684  new: state=waitForDistinguished txn=txn2 key="b" held=true guard-access=write
   685  
   686  dequeue r=req11
   687  ----
   688  global: num=1
   689   lock: "b"
   690    holder: txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   691     queued writers:
   692      active: true req: 12, txn: 00000000-0000-0000-0000-000000000003
   693     distinguished req: 12
   694  local: num=0
   695  
   696  dequeue r=req12
   697  ----
   698  global: num=1
   699   lock: "b"
   700    holder: txn: 00000000-0000-0000-0000-000000000002, ts: 0.000000010,0, info: unrepl epoch: 0, seqs: [0]
   701  local: num=0
   702  
   703  release txn=txn2 span=b
   704  -----
   705  
   706  print
   707  ----
   708  global: num=0
   709  local: num=0