@@ -30,6 +30,7 @@ import (
30
30
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/cluster"
31
31
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/option"
32
32
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/registry"
33
+ "github.com/cockroachdb/cockroach/pkg/cmd/roachtest/roachtestflags"
33
34
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/roachtestutil"
34
35
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/roachtestutil/clusterupgrade"
35
36
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/roachtestutil/mixedversion"
@@ -2950,8 +2951,8 @@ func registerBackupMixedVersion(r registry.Registry) {
2950
2951
// for the cluster used in this test without overloading it,
2951
2952
// which can make the backups take much longer to finish.
2952
2953
const numWarehouses = 100
2953
- bankInit , bankRun := bankWorkloadCmd (t .L (), testRNG , c .CRDBNodes (), false )
2954
- tpccInit , tpccRun := tpccWorkloadCmd (t .L (), testRNG , numWarehouses , c .CRDBNodes ())
2954
+ bankInit , bankRun := bankWorkloadCmd (t .L (), testRNG , roachtestflags . GlobalSeed , c .CRDBNodes (), false )
2955
+ tpccInit , tpccRun := tpccWorkloadCmd (t .L (), testRNG , roachtestflags . GlobalSeed , numWarehouses , c .CRDBNodes ())
2955
2956
2956
2957
mvt .OnStartup ("set short job interval" , backupTest .setShortJobIntervals )
2957
2958
mvt .OnStartup ("take backup in previous version" , backupTest .maybeTakePreviousVersionBackup )
@@ -2989,23 +2990,29 @@ func registerBackupMixedVersion(r registry.Registry) {
2989
2990
}
2990
2991
2991
2992
func tpccWorkloadCmd (
2992
- l * logger.Logger , testRNG * rand.Rand , numWarehouses int , roachNodes option.NodeListOption ,
2993
+ l * logger.Logger ,
2994
+ testRNG * rand.Rand ,
2995
+ seed int64 ,
2996
+ numWarehouses int ,
2997
+ roachNodes option.NodeListOption ,
2993
2998
) (init * roachtestutil.Command , run * roachtestutil.Command ) {
2994
2999
init = roachtestutil .NewCommand ("./cockroach workload init tpcc" ).
2995
3000
MaybeOption (testRNG .Intn (2 ) == 0 , "families" ).
2996
3001
Arg ("{pgurl%s}" , roachNodes ).
2997
- Flag ("warehouses" , numWarehouses )
3002
+ Flag ("warehouses" , numWarehouses ).
3003
+ MaybeFlag (seed != 0 , "seed" , seed )
2998
3004
run = roachtestutil .NewCommand ("./cockroach workload run tpcc" ).
2999
3005
Arg ("{pgurl%s}" , roachNodes ).
3000
3006
Flag ("warehouses" , numWarehouses ).
3007
+ MaybeFlag (seed != 0 , "seed" , seed ).
3001
3008
Option ("tolerate-errors" )
3002
3009
l .Printf ("tpcc init: %s" , init )
3003
3010
l .Printf ("tpcc run: %s" , run )
3004
3011
return init , run
3005
3012
}
3006
3013
3007
3014
func bankWorkloadCmd (
3008
- l * logger.Logger , testRNG * rand.Rand , roachNodes option.NodeListOption , mock bool ,
3015
+ l * logger.Logger , testRNG * rand.Rand , seed int64 , roachNodes option.NodeListOption , mock bool ,
3009
3016
) (init * roachtestutil.Command , run * roachtestutil.Command ) {
3010
3017
bankRows := bankPossibleRows [testRNG .Intn (len (bankPossibleRows ))]
3011
3018
possiblePayloads := bankPossiblePayloadBytes
@@ -3024,31 +3031,36 @@ func bankWorkloadCmd(
3024
3031
init = roachtestutil .NewCommand ("./cockroach workload init bank" ).
3025
3032
Flag ("rows" , bankRows ).
3026
3033
MaybeFlag (bankPayload != 0 , "payload-bytes" , bankPayload ).
3034
+ MaybeFlag (seed != 0 , "seed" , seed ).
3027
3035
Flag ("ranges" , 0 ).
3028
3036
Arg ("{pgurl%s}" , roachNodes )
3029
3037
run = roachtestutil .NewCommand ("./cockroach workload run bank" ).
3030
3038
Arg ("{pgurl%s}" , roachNodes ).
3039
+ MaybeFlag (seed != 0 , "seed" , seed ).
3031
3040
Option ("tolerate-errors" )
3032
3041
l .Printf ("bank init: %s" , init )
3033
3042
l .Printf ("bank run: %s" , run )
3034
3043
return init , run
3035
3044
}
3036
3045
3037
3046
func schemaChangeWorkloadCmd (
3038
- l * logger.Logger , testRNG * rand.Rand , roachNodes option.NodeListOption , mock bool ,
3047
+ l * logger.Logger , testRNG * rand.Rand , seed int64 , roachNodes option.NodeListOption , mock bool ,
3039
3048
) (init * roachtestutil.Command , run * roachtestutil.Command ) {
3040
3049
maxOps := 1000
3041
3050
concurrency := 5
3042
3051
if mock {
3043
3052
maxOps = 10
3044
3053
concurrency = 2
3045
3054
}
3046
- initCmd := roachtestutil .NewCommand ("./workload init schemachange" ).
3055
+ if seed == 0 {
3056
+ seed = testRNG .Int63 ()
3057
+ }
3058
+ initCmd := roachtestutil .NewCommand ("COCKROACH_RANDOM_SEED=%d ./workload init schemachange" , seed ).
3047
3059
Arg ("{pgurl%s}" , roachNodes )
3048
3060
// TODO (msbutler): ideally we'd use the `db` flag to explicitly set the
3049
3061
// database, but it is currently broken:
3050
3062
// https://github.com/cockroachdb/cockroach/issues/115545
3051
- runCmd := roachtestutil .NewCommand ("COCKROACH_RANDOM_SEED=%d ./workload run schemachange" , testRNG . Int63 () ).
3063
+ runCmd := roachtestutil .NewCommand ("COCKROACH_RANDOM_SEED=%d ./workload run schemachange" , seed ).
3052
3064
Flag ("verbose" , 1 ).
3053
3065
Flag ("max-ops" , maxOps ).
3054
3066
Flag ("concurrency" , concurrency ).
0 commit comments