Skip to content

Commit

Permalink
Merge pull request #222 from scylladb/issue_218
Browse files Browse the repository at this point in the history
gemini,schema: general table option added
  • Loading branch information
Henrik Johansson authored Feb 19, 2020
2 parents 07e8843 + 24a2f2f commit 45fb788
Show file tree
Hide file tree
Showing 8 changed files with 214 additions and 163 deletions.
33 changes: 15 additions & 18 deletions cmd/gemini/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
"github.com/scylladb/gemini"
"github.com/scylladb/gemini/replication"
"github.com/scylladb/gemini/store"
"github.com/scylladb/gemini/tableopts"
"github.com/spf13/cobra"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
Expand All @@ -57,8 +58,8 @@ var (
duration time.Duration
bind string
warmup time.Duration
compactionStrategy string
replicationStrategy string
tableOptions []string
oracleReplicationStrategy string
consistency string
maxTables int
Expand Down Expand Up @@ -385,24 +386,20 @@ func createClusters(consistency gocql.Consistency) (*gocql.ClusterConfig, *gocql
return testCluster, oracleCluster
}

func getCompactionStrategy(cs string, logger *zap.Logger) *gemini.CompactionStrategy {
switch cs {
case "stcs":
return gemini.NewSizeTieredCompactionStrategy()
case "twcs":
return gemini.NewTimeWindowCompactionStrategy()
case "lcs":
return gemini.NewLeveledCompactionStrategy()
case "":
return nil
default:
compactionStrategy := &gemini.CompactionStrategy{}
if err := json.Unmarshal([]byte(strings.ReplaceAll(cs, "'", "\"")), compactionStrategy); err != nil {
logger.Error("unable to parse compaction strategy", zap.String("strategy", cs), zap.Error(err))
return nil
func createTableOptions(tableOptionStrings []string, logger *zap.Logger) []tableopts.Option {
var tableOptions []tableopts.Option
for _, optionString := range tableOptionStrings {
o, err := tableopts.FromCQL(optionString)
if err != nil {
logger.Warn("invalid table option", zap.String("option", optionString), zap.Error(err))
fmt.Println("----------------------------------")
fmt.Println(optionString)
fmt.Println("----------------------------------")
continue
}
return compactionStrategy
tableOptions = append(tableOptions, o)
}
return tableOptions
}

func getReplicationStrategy(rs string, fallback *replication.Replication, logger *zap.Logger) *replication.Replication {
Expand Down Expand Up @@ -457,9 +454,9 @@ func init() {
rootCmd.Flags().StringVarP(&outFileArg, "outfile", "", "", "Specify the name of the file where the results should go")
rootCmd.Flags().StringVarP(&bind, "bind", "b", ":2112", "Specify the interface and port which to bind prometheus metrics on. Default is ':2112'")
rootCmd.Flags().DurationVarP(&warmup, "warmup", "", 30*time.Second, "Specify the warmup perid as a duration for example 30s or 10h")
rootCmd.Flags().StringVarP(&compactionStrategy, "compaction-strategy", "", "", "Specify the desired CS as either the coded short hand stcs|twcs|lcs to get the default for each type or provide the entire specification in the form {'class':'....'}")
rootCmd.Flags().StringVarP(&replicationStrategy, "replication-strategy", "", "simple", "Specify the desired replication strategy as either the coded short hand simple|network to get the default for each type or provide the entire specification in the form {'class':'....'}")
rootCmd.Flags().StringVarP(&oracleReplicationStrategy, "oracle-replication-strategy", "", "simple", "Specify the desired replication strategy of the oracle cluster as either the coded short hand simple|network to get the default for each type or provide the entire specification in the form {'class':'....'}")
rootCmd.Flags().StringArrayVarP(&tableOptions, "table-options", "", []string{}, "Repeatable argument to set table options to be added to the created tables")
rootCmd.Flags().StringVarP(&consistency, "consistency", "", "QUORUM", "Specify the desired consistency as ANY|ONE|TWO|THREE|QUORUM|LOCAL_QUORUM|EACH_QUORUM|LOCAL_ONE")
rootCmd.Flags().IntVarP(&maxTables, "max-tables", "", 1, "Maximum number of generated tables")
rootCmd.Flags().IntVarP(&maxPartitionKeys, "max-partition-keys", "", 6, "Maximum number of generated partition keys")
Expand Down
4 changes: 2 additions & 2 deletions cmd/gemini/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ func createSchemaConfig(logger *zap.Logger) gemini.SchemaConfig {
switch strings.ToLower(datasetSize) {
case "small":
return gemini.SchemaConfig{
CompactionStrategy: defaultConfig.CompactionStrategy,
ReplicationStrategy: defaultConfig.ReplicationStrategy,
OracleReplicationStrategy: defaultConfig.OracleReplicationStrategy,
TableOptions: defaultConfig.TableOptions,
MaxTables: defaultConfig.MaxTables,
MaxPartitionKeys: defaultConfig.MaxPartitionKeys,
MinPartitionKeys: defaultConfig.MinPartitionKeys,
Expand Down Expand Up @@ -63,9 +63,9 @@ func createDefaultSchemaConfig(logger *zap.Logger) gemini.SchemaConfig {
rs := getReplicationStrategy(replicationStrategy, replication.NewSimpleStrategy(), logger)
ors := getReplicationStrategy(oracleReplicationStrategy, rs, logger)
return gemini.SchemaConfig{
CompactionStrategy: getCompactionStrategy(compactionStrategy, logger),
ReplicationStrategy: rs,
OracleReplicationStrategy: ors,
TableOptions: createTableOptions(tableOptions, logger),
MaxTables: maxTables,
MaxPartitionKeys: maxPartitionKeys,
MinPartitionKeys: minPartitionKeys,
Expand Down
78 changes: 0 additions & 78 deletions compaction.go

This file was deleted.

3 changes: 3 additions & 0 deletions docs/cli-arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ performed. Default is 30 seconds.
standard out is used.

11. ___--max-tables___: Maximum number of tables in the generated schema.

12. __--table-options__: Repeatable argument to set table options for example:
_--table-options"compression = {'sstable_compression': 'LZ4Compressor'}"_
78 changes: 41 additions & 37 deletions docs/cmdhelp.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,45 @@ Usage:
gemini [flags]

Flags:
-b, --bind string Specify the interface and port which to bind prometheus metrics on. Default is ':2112' (default ":2112")
--compaction-strategy string Specify the desired CS as either the coded short hand stcs|twcs|lcs to get the default for each type or provide the entire specification in the form {'class':'....'}
-c, --concurrency uint Number of threads per table to run concurrently (default 10)
--consistency string Specify the desired consistency as ANY|ONE|TWO|THREE|QUORUM|LOCAL_QUORUM|EACH_QUORUM|LOCAL_ONE (default "QUORUM")
--cql-features string Specify the type of cql features to use, basic|normal|all (default "basic")
--dataset-size string Specify the type of dataset size to use, small|large (default "large")
-d, --drop-schema Drop schema before starting tests run
--duration duration (default 30s)
-f, --fail-fast Stop on the first failure
-h, --help help for gemini
--level string Specify the logging level, debug|info|warn|error|dpanic|panic|fatal (default "info")
--max-clustering-keys int Maximum number of generated clustering keys (default 4)
--max-columns int Maximum number of generated columns (default 16)
--max-mutation-retries int Maximum number of attempts to apply a mutation (default 2)
--max-mutation-retries-backoff duration Duration between attempts to apply a mutation for example 10ms or 1s (default 10ms)
--max-partition-keys int Maximum number of generated partition keys (default 6)
--min-clustering-keys int Minimum number of generated clustering keys (default 2)
--min-columns int Minimum number of generated columns (default 8)
--min-partition-keys int Minimum number of generated partition keys (default 2)
-m, --mode string Query operation mode. Mode options: write, read, mixed (default) (default "mixed")
--non-interactive Run in non-interactive mode (disable progress indicator)
--normal-dist-mean float Mean of the normal distribution (default 9.223372036854776e+18)
--normal-dist-sigma float Sigma of the normal distribution, defaults to one standard deviation ~0.341 (default 6.290339729134958e+18)
-o, --oracle-cluster strings Host names or IPs of the oracle cluster that provides correct answers. If omitted no oracle will be used
--outfile string Specify the name of the file where the results should go
--partition-key-buffer-reuse-size uint Number of reused buffered partition keys (default 100)
--partition-key-distribution string Specify the distribution from which to draw partition keys, supported values are currently uniform|normal|zipf (default "uniform")
--replication-strategy string Specify the desired replication strategy as either the coded short hand simple|network to get the default for each type or provide the entire specification in the form {'class':'....'} (default "simple")
--schema string Schema JSON config file
-s, --seed uint PRNG seed value (default 1)
-t, --test-cluster strings Host names or IPs of the test cluster that is system under test
--token-range-slices uint Number of slices to divide the token space into (default 10000)
--tracing-outfile string Specify the file to which tracing information gets written. Two magic names are available, 'stdout' and 'stderr'. By default tracing is disabled.
--use-counters Ensure that at least one table is a counter table
-v, --verbose Verbose output during test run
--version version for gemini
--warmup duration Specify the warmup perid as a duration for example 30s or 10h (default 30s)
--async-objects-stabilization-attempts int Maximum number of attempts to validate result sets from MV and SI (default 10)
--async-objects-stabilization-backoff duration Duration between attempts to validate result sets from MV and SI for example 10ms or 1s (default 10ms)
-b, --bind string Specify the interface and port which to bind prometheus metrics on. Default is ':2112' (default ":2112")
-c, --concurrency uint Number of threads per table to run concurrently (default 10)
--consistency string Specify the desired consistency as ANY|ONE|TWO|THREE|QUORUM|LOCAL_QUORUM|EACH_QUORUM|LOCAL_ONE (default "QUORUM")
--cql-features string Specify the type of cql features to use, basic|normal|all (default "basic")
--dataset-size string Specify the type of dataset size to use, small|large (default "large")
-d, --drop-schema Drop schema before starting tests run
--duration duration (default 30s)
-f, --fail-fast Stop on the first failure
-h, --help help for gemini
--level string Specify the logging level, debug|info|warn|error|dpanic|panic|fatal (default "info")
--max-clustering-keys int Maximum number of generated clustering keys (default 4)
--max-columns int Maximum number of generated columns (default 16)
--max-mutation-retries int Maximum number of attempts to apply a mutation (default 2)
--max-mutation-retries-backoff duration Duration between attempts to apply a mutation for example 10ms or 1s (default 10ms)
--max-partition-keys int Maximum number of generated partition keys (default 6)
--max-tables int Maximum number of generated tables (default 1)
--min-clustering-keys int Minimum number of generated clustering keys (default 2)
--min-columns int Minimum number of generated columns (default 8)
--min-partition-keys int Minimum number of generated partition keys (default 2)
-m, --mode string Query operation mode. Mode options: write, read, mixed (default) (default "mixed")
--non-interactive Run in non-interactive mode (disable progress indicator)
--normal-dist-mean float Mean of the normal distribution (default 9.223372036854776e+18)
--normal-dist-sigma float Sigma of the normal distribution, defaults to one standard deviation ~0.341 (default 6.290339729134958e+18)
-o, --oracle-cluster strings Host names or IPs of the oracle cluster that provides correct answers. If omitted no oracle will be used
--oracle-replication-strategy string Specify the desired replication strategy of the oracle cluster as either the coded short hand simple|network to get the default for each type or provide the entire specification in the form {'class':'....'} (default "simple")
--outfile string Specify the name of the file where the results should go
--partition-key-buffer-reuse-size uint Number of reused buffered partition keys (default 100)
--partition-key-distribution string Specify the distribution from which to draw partition keys, supported values are currently uniform|normal|zipf (default "uniform")
--replication-strategy string Specify the desired replication strategy as either the coded short hand simple|network to get the default for each type or provide the entire specification in the form {'class':'....'} (default "simple")
--schema string Schema JSON config file
-s, --seed uint PRNG seed value (default 1)
--table-options stringArray Repeatable argument to set table options to be added to the created tables
-t, --test-cluster strings Host names or IPs of the test cluster that is system under test
--token-range-slices uint Number of slices to divide the token space into (default 10000)
--tracing-outfile string Specify the file to which tracing information gets written. Two magic names are available, 'stdout' and 'stderr'. By default tracing is disabled.
--use-counters Ensure that at least one table is a counter table
-v, --verbose Verbose output during test run
--version version for gemini
--warmup duration Specify the warmup perid as a duration for example 30s or 10h (default 30s)
```
Loading

0 comments on commit 45fb788

Please sign in to comment.