@@ -261,6 +261,10 @@ type ClientOperationConfig struct {
261
261
AddSSTable int
262
262
// Barrier is an operation that waits for in-flight writes to complete.
263
263
Barrier int
264
+
265
+ // FlushLockTable is an operation that moves unreplicated locks in the
266
+ // in-memory lock table into the
267
+ FlushLockTable int
264
268
}
265
269
266
270
// BatchOperationConfig configures the relative probability of generating a
@@ -401,6 +405,7 @@ func newAllOperationsConfig() GeneratorConfig {
401
405
DeleteRangeUsingTombstone : 1 ,
402
406
AddSSTable : 1 ,
403
407
Barrier : 1 ,
408
+ FlushLockTable : 1 ,
404
409
}
405
410
batchOpConfig := BatchOperationConfig {
406
411
Batch : 4 ,
@@ -536,6 +541,11 @@ func NewDefaultConfig() GeneratorConfig {
536
541
config .Ops .ClosureTxn .CommitBatchOps .Barrier = 0
537
542
config .Ops .ClosureTxn .TxnClientOps .Barrier = 0
538
543
config .Ops .ClosureTxn .TxnBatchOps .Ops .Barrier = 0
544
+
545
+ config .Ops .Batch .Ops .FlushLockTable = 0
546
+ config .Ops .ClosureTxn .CommitBatchOps .FlushLockTable = 0
547
+ config .Ops .ClosureTxn .TxnClientOps .FlushLockTable = 0
548
+ config .Ops .ClosureTxn .TxnBatchOps .Ops .FlushLockTable = 0
539
549
return config
540
550
}
541
551
@@ -833,6 +843,7 @@ func (g *generator) registerClientOps(allowed *[]opGen, c *ClientOperationConfig
833
843
addOpGen (allowed , randDelRangeUsingTombstone , c .DeleteRangeUsingTombstone )
834
844
addOpGen (allowed , randAddSSTable , c .AddSSTable )
835
845
addOpGen (allowed , randBarrier , c .Barrier )
846
+ addOpGen (allowed , randFlushLockTable , c .FlushLockTable )
836
847
}
837
848
838
849
func (g * generator ) registerBatchOps (allowed * []opGen , c * BatchOperationConfig ) {
@@ -1138,6 +1149,19 @@ func randBarrier(g *generator, rng *rand.Rand) Operation {
1138
1149
return barrier (key , endKey , withLAI )
1139
1150
}
1140
1151
1152
+ func randFlushLockTable (g * generator , rng * rand.Rand ) Operation {
1153
+ // FlushLockTable can't span multiple ranges. We want to test a combination of
1154
+ // requests that span the entire range and those that span part of a range.
1155
+ key , endKey := randRangeSpan (rng , g .currentSplits )
1156
+
1157
+ wholeRange := rng .Float64 () < 0.5
1158
+ if ! wholeRange {
1159
+ key = randKeyBetween (rng , key , endKey )
1160
+ }
1161
+
1162
+ return flushLockTable (key , endKey )
1163
+ }
1164
+
1141
1165
func randScan (g * generator , rng * rand.Rand ) Operation {
1142
1166
key , endKey := randSpan (rng )
1143
1167
return scan (key , endKey )
@@ -1976,6 +2000,13 @@ func barrier(key, endKey string, withLAI bool) Operation {
1976
2000
}}
1977
2001
}
1978
2002
2003
+ func flushLockTable (key , endKey string ) Operation {
2004
+ return Operation {FlushLockTable : & FlushLockTableOperation {
2005
+ Key : []byte (key ),
2006
+ EndKey : []byte (endKey ),
2007
+ }}
2008
+ }
2009
+
1979
2010
func createSavepoint (id int ) Operation {
1980
2011
return Operation {SavepointCreate : & SavepointCreateOperation {ID : int32 (id )}}
1981
2012
}
0 commit comments