Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(materialized-views): add cli flags to disable materialized views #424

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmd/gemini/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ var (
minColumns int
datasetSize string
cqlFeatures string
useMaterializedViews bool
level string
maxRetriesMutate int
maxRetriesMutateSleep time.Duration
Expand Down Expand Up @@ -496,6 +497,7 @@ func init() {
rootCmd.Flags().IntVarP(&minColumns, "min-columns", "", 8, "Minimum number of generated columns")
rootCmd.Flags().StringVarP(&datasetSize, "dataset-size", "", "large", "Specify the type of dataset size to use, small|large")
rootCmd.Flags().StringVarP(&cqlFeatures, "cql-features", "", "basic", "Specify the type of cql features to use, basic|normal|all")
rootCmd.Flags().BoolVarP(&useMaterializedViews, "materialized-views", "", false, "Run gemini with materialized views support")
rootCmd.Flags().StringVarP(&level, "level", "", "info", "Specify the logging level, debug|info|warn|error|dpanic|panic|fatal")
rootCmd.Flags().IntVarP(&maxRetriesMutate, "max-mutation-retries", "", 2, "Maximum number of attempts to apply a mutation")
rootCmd.Flags().DurationVarP(
Expand Down
2 changes: 2 additions & 0 deletions cmd/gemini/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func createSchemaConfig(logger *zap.Logger) typedef.SchemaConfig {
UseLWT: defaultConfig.UseLWT,
CQLFeature: defaultConfig.CQLFeature,
AsyncObjectStabilizationAttempts: defaultConfig.AsyncObjectStabilizationAttempts,
UseMaterializedViews: defaultConfig.UseMaterializedViews,
AsyncObjectStabilizationDelay: defaultConfig.AsyncObjectStabilizationDelay,
}
default:
Expand Down Expand Up @@ -85,6 +86,7 @@ func createDefaultSchemaConfig(logger *zap.Logger) typedef.SchemaConfig {
UseCounters: useCounters,
UseLWT: useLWT,
CQLFeature: getCQLFeature(cqlFeatures),
UseMaterializedViews: useMaterializedViews,
AsyncObjectStabilizationAttempts: asyncObjectStabilizationAttempts,
AsyncObjectStabilizationDelay: asyncObjectStabilizationDelay,
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/generators/statement_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func genTable(sc typedef.SchemaConfig, tableName string, r *rand.Rand) *typedef.
table.Indexes = indexes

var mvs []typedef.MaterializedView
if sc.CQLFeature > typedef.CQL_FEATURE_BASIC && len(clusteringKeys) > 0 && columns.ValidColumnsForPrimaryKey().Len() != 0 {
if sc.CQLFeature > typedef.CQL_FEATURE_BASIC && sc.UseMaterializedViews && len(clusteringKeys) > 0 && columns.ValidColumnsForPrimaryKey().Len() != 0 {
mvs = CreateMaterializedViews(columns, table.Name, partitionKeys, clusteringKeys, r)
}

Expand Down
1 change: 1 addition & 0 deletions pkg/typedef/schemaconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type SchemaConfig struct {
MinStringLength int
UseCounters bool
UseLWT bool
UseMaterializedViews bool
CQLFeature CQLFeature
AsyncObjectStabilizationAttempts int
AsyncObjectStabilizationDelay time.Duration
Expand Down
Loading