@@ -267,6 +267,10 @@ type ClientOperationConfig struct {
267
267
AddSSTable int
268
268
// Barrier is an operation that waits for in-flight writes to complete.
269
269
Barrier int
270
+
271
+ // FlushLockTable is an operation that moves unreplicated locks in the
272
+ // in-memory lock table into the
273
+ FlushLockTable int
270
274
}
271
275
272
276
// BatchOperationConfig configures the relative probability of generating a
@@ -407,6 +411,7 @@ func newAllOperationsConfig() GeneratorConfig {
407
411
DeleteRangeUsingTombstone : 1 ,
408
412
AddSSTable : 1 ,
409
413
Barrier : 1 ,
414
+ FlushLockTable : 1 ,
410
415
}
411
416
batchOpConfig := BatchOperationConfig {
412
417
Batch : 4 ,
@@ -542,6 +547,11 @@ func NewDefaultConfig() GeneratorConfig {
542
547
config .Ops .ClosureTxn .CommitBatchOps .Barrier = 0
543
548
config .Ops .ClosureTxn .TxnClientOps .Barrier = 0
544
549
config .Ops .ClosureTxn .TxnBatchOps .Ops .Barrier = 0
550
+
551
+ config .Ops .Batch .Ops .FlushLockTable = 0
552
+ config .Ops .ClosureTxn .CommitBatchOps .FlushLockTable = 0
553
+ config .Ops .ClosureTxn .TxnClientOps .FlushLockTable = 0
554
+ config .Ops .ClosureTxn .TxnBatchOps .Ops .FlushLockTable = 0
545
555
return config
546
556
}
547
557
@@ -839,6 +849,7 @@ func (g *generator) registerClientOps(allowed *[]opGen, c *ClientOperationConfig
839
849
addOpGen (allowed , randDelRangeUsingTombstone , c .DeleteRangeUsingTombstone )
840
850
addOpGen (allowed , randAddSSTable , c .AddSSTable )
841
851
addOpGen (allowed , randBarrier , c .Barrier )
852
+ addOpGen (allowed , randFlushLockTable , c .FlushLockTable )
842
853
}
843
854
844
855
func (g * generator ) registerBatchOps (allowed * []opGen , c * BatchOperationConfig ) {
@@ -1144,6 +1155,19 @@ func randBarrier(g *generator, rng *rand.Rand) Operation {
1144
1155
return barrier (key , endKey , withLAI )
1145
1156
}
1146
1157
1158
+ func randFlushLockTable (g * generator , rng * rand.Rand ) Operation {
1159
+ // FlushLockTable can't span multiple ranges. We want to test a combination of
1160
+ // requests that span the entire range and those that span part of a range.
1161
+ key , endKey := randRangeSpan (rng , g .currentSplits )
1162
+
1163
+ wholeRange := rng .Float64 () < 0.5
1164
+ if ! wholeRange {
1165
+ key = randKeyBetween (rng , key , endKey )
1166
+ }
1167
+
1168
+ return flushLockTable (key , endKey )
1169
+ }
1170
+
1147
1171
func randScan (g * generator , rng * rand.Rand ) Operation {
1148
1172
key , endKey := randSpan (rng )
1149
1173
return scan (key , endKey )
@@ -1986,6 +2010,13 @@ func barrier(key, endKey string, withLAI bool) Operation {
1986
2010
}}
1987
2011
}
1988
2012
2013
+ func flushLockTable (key , endKey string ) Operation {
2014
+ return Operation {FlushLockTable : & FlushLockTableOperation {
2015
+ Key : []byte (key ),
2016
+ EndKey : []byte (endKey ),
2017
+ }}
2018
+ }
2019
+
1989
2020
func createSavepoint (id int ) Operation {
1990
2021
return Operation {SavepointCreate : & SavepointCreateOperation {ID : int32 (id )}}
1991
2022
}
0 commit comments