From 035ddb9b1767c35841f5cbab7323ff969cfc37a1 Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Thu, 16 Apr 2020 15:53:49 +0300 Subject: [PATCH] gemini: Avoid DDL operations for a table with MV (#235) Scylla does not allow dropping a column that is part of a materialized view. Let's avoid doing DDL operations altogether for such cases to be safe. Fixes #230 --- cmd/gemini/jobs.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/gemini/jobs.go b/cmd/gemini/jobs.go index 20a9a7d5..5714f3bc 100644 --- a/cmd/gemini/jobs.go +++ b/cmd/gemini/jobs.go @@ -140,6 +140,10 @@ func ddl(ctx context.Context, schema *gemini.Schema, sc *gemini.SchemaConfig, ta return } table.Lock() + if len(table.MaterializedViews) > 0 { + // Scylla does not allow changing the DDL of a table with materialized views. + return + } defer table.Unlock() ddlStmts, postStmtHook, err := schema.GenDDLStmt(table, r, p, sc) if err != nil {