From 42df0fc25ab106bbd711d03e9a83f55d24368295 Mon Sep 17 00:00:00 2001 From: Maxim Fateev Date: Fri, 14 Sep 2018 17:09:30 -0700 Subject: [PATCH] Moved cassandra schema to schema/cassandra (#1115) Preparation for multiple databases implementations. --- Makefile | 12 ++++++------ common/persistence/cassandra/cassandraPersistence.go | 8 ++++---- .../cassandra/cassandraPersistenceTest.go | 4 ++-- common/persistence/dataInterfaces.go | 2 +- docker/start.sh | 4 ++-- schema/{ => cassandra}/README.md | 0 schema/{ => cassandra}/cadence/keyspace.cql | 0 schema/{ => cassandra}/cadence/schema.cql | 0 .../{ => cassandra}/cadence/versioned/v0.1/base.cql | 0 .../cadence/versioned/v0.1/manifest.json | 0 .../cadence/versioned/v0.10/event_batch_version.cql | 0 .../cadence/versioned/v0.10/manifest.json | 0 .../cadence/versioned/v0.11/manifest.json | 0 .../cadence/versioned/v0.11/workflow_retry.cql | 0 .../cadence/versioned/v0.2/add_buffered_events.cql | 0 .../cadence/versioned/v0.2/add_sticky_tasklist.cql | 0 .../cadence/versioned/v0.2/add_wf_timeout.cql | 0 .../versioned/v0.2/fail_decision_mutable_state.cql | 0 .../cadence/versioned/v0.2/manifest.json | 0 .../cadence/versioned/v0.3/add_client_version.cql | 0 .../versioned/v0.3/add_last_first_event_id.cql | 0 .../cadence/versioned/v0.3/manifest.json | 0 .../cadence/versioned/v0.4/add_signal_decision.cql | 0 .../cadence/versioned/v0.4/add_tasklist_kind.cql | 0 .../cadence/versioned/v0.4/manifest.json | 0 .../versioned/v0.5/add_domain_config_version.cql | 0 .../versioned/v0.5/add_replication_config.cql | 0 ...d_target_child_workflow_only_to_transfer_task.cql | 0 .../cadence/versioned/v0.5/manifest.json | 0 .../versioned/v0.6/add_shard_cluster_ack_level.cql | 0 .../versioned/v0.6/history_replication_task.cql | 0 .../cadence/versioned/v0.6/manifest.json | 0 .../versioned/v0.7/buffered_replication_task.cql | 0 .../versioned/v0.7/failover_version_persistence.cql | 0 .../cadence/versioned/v0.7/manifest.json | 0 .../cadence/versioned/v0.7/retry_policy.cql | 0 .../cadence/versioned/v0.8/domain_notification.cql | 0 .../cadence/versioned/v0.8/manifest.json | 0 .../cadence/versioned/v0.9/domain_data.cql | 0 .../cadence/versioned/v0.9/manifest.json | 0 .../cadence/versioned/v0.9/transfer_timestamp.cql | 0 schema/{ => cassandra}/visibility/keyspace.cql | 0 schema/{ => cassandra}/visibility/schema.cql | 0 .../visibility/versioned/v0.1/base.cql | 0 .../visibility/versioned/v0.1/manifest.json | 0 .../visibility/versioned/v0.2/manifest.json | 0 .../v0.2/reduce_open_workflow_tombstones.cql | 0 tools/cassandra/README.md | 12 ++++++------ tools/cassandra/updateTask_test.go | 2 +- tools/cassandra/version.go | 4 ++-- tools/cassandra/version_test.go | 4 ++-- 51 files changed, 26 insertions(+), 26 deletions(-) rename schema/{ => cassandra}/README.md (100%) rename schema/{ => cassandra}/cadence/keyspace.cql (100%) rename schema/{ => cassandra}/cadence/schema.cql (100%) rename schema/{ => cassandra}/cadence/versioned/v0.1/base.cql (100%) rename schema/{ => cassandra}/cadence/versioned/v0.1/manifest.json (100%) rename schema/{ => cassandra}/cadence/versioned/v0.10/event_batch_version.cql (100%) rename schema/{ => cassandra}/cadence/versioned/v0.10/manifest.json (100%) rename schema/{ => cassandra}/cadence/versioned/v0.11/manifest.json (100%) rename schema/{ => cassandra}/cadence/versioned/v0.11/workflow_retry.cql (100%) rename schema/{ => cassandra}/cadence/versioned/v0.2/add_buffered_events.cql (100%) rename schema/{ => cassandra}/cadence/versioned/v0.2/add_sticky_tasklist.cql (100%) rename schema/{ => cassandra}/cadence/versioned/v0.2/add_wf_timeout.cql (100%) rename schema/{ => cassandra}/cadence/versioned/v0.2/fail_decision_mutable_state.cql (100%) rename schema/{ => cassandra}/cadence/versioned/v0.2/manifest.json (100%) rename schema/{ => cassandra}/cadence/versioned/v0.3/add_client_version.cql (100%) rename schema/{ => cassandra}/cadence/versioned/v0.3/add_last_first_event_id.cql (100%) rename schema/{ => cassandra}/cadence/versioned/v0.3/manifest.json (100%) rename schema/{ => cassandra}/cadence/versioned/v0.4/add_signal_decision.cql (100%) rename schema/{ => cassandra}/cadence/versioned/v0.4/add_tasklist_kind.cql (100%) rename schema/{ => cassandra}/cadence/versioned/v0.4/manifest.json (100%) rename schema/{ => cassandra}/cadence/versioned/v0.5/add_domain_config_version.cql (100%) rename schema/{ => cassandra}/cadence/versioned/v0.5/add_replication_config.cql (100%) rename schema/{ => cassandra}/cadence/versioned/v0.5/add_target_child_workflow_only_to_transfer_task.cql (100%) rename schema/{ => cassandra}/cadence/versioned/v0.5/manifest.json (100%) rename schema/{ => cassandra}/cadence/versioned/v0.6/add_shard_cluster_ack_level.cql (100%) rename schema/{ => cassandra}/cadence/versioned/v0.6/history_replication_task.cql (100%) rename schema/{ => cassandra}/cadence/versioned/v0.6/manifest.json (100%) rename schema/{ => cassandra}/cadence/versioned/v0.7/buffered_replication_task.cql (100%) rename schema/{ => cassandra}/cadence/versioned/v0.7/failover_version_persistence.cql (100%) rename schema/{ => cassandra}/cadence/versioned/v0.7/manifest.json (100%) rename schema/{ => cassandra}/cadence/versioned/v0.7/retry_policy.cql (100%) rename schema/{ => cassandra}/cadence/versioned/v0.8/domain_notification.cql (100%) rename schema/{ => cassandra}/cadence/versioned/v0.8/manifest.json (100%) rename schema/{ => cassandra}/cadence/versioned/v0.9/domain_data.cql (100%) rename schema/{ => cassandra}/cadence/versioned/v0.9/manifest.json (100%) rename schema/{ => cassandra}/cadence/versioned/v0.9/transfer_timestamp.cql (100%) rename schema/{ => cassandra}/visibility/keyspace.cql (100%) rename schema/{ => cassandra}/visibility/schema.cql (100%) rename schema/{ => cassandra}/visibility/versioned/v0.1/base.cql (100%) rename schema/{ => cassandra}/visibility/versioned/v0.1/manifest.json (100%) rename schema/{ => cassandra}/visibility/versioned/v0.2/manifest.json (100%) rename schema/{ => cassandra}/visibility/versioned/v0.2/reduce_open_workflow_tombstones.cql (100%) diff --git a/Makefile b/Makefile index 62d78382810..190cd746957 100644 --- a/Makefile +++ b/Makefile @@ -161,10 +161,10 @@ clean: install-schema: bins ./cadence-cassandra-tool --ep 127.0.0.1 create -k cadence --rf 1 ./cadence-cassandra-tool -ep 127.0.0.1 -k cadence setup-schema -v 0.0 - ./cadence-cassandra-tool -ep 127.0.0.1 -k cadence update-schema -d ./schema/cadence/versioned + ./cadence-cassandra-tool -ep 127.0.0.1 -k cadence update-schema -d ./schema/cassandra/cadence/versioned ./cadence-cassandra-tool --ep 127.0.0.1 create -k cadence_visibility --rf 1 ./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility setup-schema -v 0.0 - ./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility update-schema -d ./schema/visibility/versioned + ./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility update-schema -d ./schema/cassandra/visibility/versioned start: bins ./cadence-server start @@ -173,17 +173,17 @@ install-schema-cdc: bins @echo Setting up cadence_active key space ./cadence-cassandra-tool --ep 127.0.0.1 create -k cadence_active --rf 1 ./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_active setup-schema -v 0.0 - ./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_active update-schema -d ./schema/cadence/versioned + ./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_active update-schema -d ./schema/cassandra/cadence/versioned ./cadence-cassandra-tool --ep 127.0.0.1 create -k cadence_visibility_active --rf 1 ./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility_active setup-schema -v 0.0 - ./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility_active update-schema -d ./schema/visibility/versioned + ./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility_active update-schema -d ./schema/cassandra/visibility/versioned @echo Setting up cadence_standby key space ./cadence-cassandra-tool --ep 127.0.0.1 create -k cadence_standby --rf 1 ./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_standby setup-schema -v 0.0 - ./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_standby update-schema -d ./schema/cadence/versioned + ./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_standby update-schema -d ./schema/cassandra/cadence/versioned ./cadence-cassandra-tool --ep 127.0.0.1 create -k cadence_visibility_standby --rf 1 ./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility_standby setup-schema -v 0.0 - ./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility_standby update-schema -d ./schema/visibility/versioned + ./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility_standby update-schema -d ./schema/cassandra/visibility/versioned start-cdc-active: bins ./cadence-server --zone active start diff --git a/common/persistence/cassandra/cassandraPersistence.go b/common/persistence/cassandra/cassandraPersistence.go index eac618c9b4e..e76500bd228 100644 --- a/common/persistence/cassandra/cassandraPersistence.go +++ b/common/persistence/cassandra/cassandraPersistence.go @@ -2587,7 +2587,7 @@ func (d *cassandraPersistence) createTransferTasks(batch *gocql.Batch, transferT var taskList string var scheduleID int64 targetWorkflowID := p.TransferTaskTransferTargetWorkflowID - targetRunID := p.TransferTaskTypeTransferTargetRunID + targetRunID := p.TransferTaskTransferTargetRunID targetChildWorkflowOnly := false switch task.GetType() { @@ -2606,7 +2606,7 @@ func (d *cassandraPersistence) createTransferTasks(batch *gocql.Batch, transferT targetWorkflowID = task.(*p.CancelExecutionTask).TargetWorkflowID targetRunID = task.(*p.CancelExecutionTask).TargetRunID if targetRunID == "" { - targetRunID = p.TransferTaskTypeTransferTargetRunID + targetRunID = p.TransferTaskTransferTargetRunID } targetChildWorkflowOnly = task.(*p.CancelExecutionTask).TargetChildWorkflowOnly scheduleID = task.(*p.CancelExecutionTask).InitiatedID @@ -2616,7 +2616,7 @@ func (d *cassandraPersistence) createTransferTasks(batch *gocql.Batch, transferT targetWorkflowID = task.(*p.SignalExecutionTask).TargetWorkflowID targetRunID = task.(*p.SignalExecutionTask).TargetRunID if targetRunID == "" { - targetRunID = p.TransferTaskTypeTransferTargetRunID + targetRunID = p.TransferTaskTransferTargetRunID } targetChildWorkflowOnly = task.(*p.SignalExecutionTask).TargetChildWorkflowOnly scheduleID = task.(*p.SignalExecutionTask).InitiatedID @@ -3385,7 +3385,7 @@ func createTransferTaskInfo(result map[string]interface{}) *p.TransferTaskInfo { info.TargetWorkflowID = v.(string) case "target_run_id": info.TargetRunID = v.(gocql.UUID).String() - if info.TargetRunID == p.TransferTaskTypeTransferTargetRunID { + if info.TargetRunID == p.TransferTaskTransferTargetRunID { info.TargetRunID = "" } case "target_child_workflow_only": diff --git a/common/persistence/cassandra/cassandraPersistenceTest.go b/common/persistence/cassandra/cassandraPersistenceTest.go index b60a75f1d7b..c54183d41b5 100644 --- a/common/persistence/cassandra/cassandraPersistenceTest.go +++ b/common/persistence/cassandra/cassandraPersistenceTest.go @@ -41,7 +41,7 @@ const ( testUser = "" testPassword = "" testDatacenter = "" - testSchemaDir = "schema/" + testSchemaDir = "schema/cassandra/" ) // TestCluster allows executing cassandra operations in testing. @@ -80,7 +80,7 @@ func InitTestSuiteWithMetadata(tb *persistencetests.TestBase, options *persisten panic("nil metadata") } if options.SchemaDir == "" { - options.SchemaDir = "schema" + options.SchemaDir = testSchemaDir } log := bark.NewLoggerFromLogrus(log.New()) tb.PersistenceTestCluster = &TestCluster{} diff --git a/common/persistence/dataInterfaces.go b/common/persistence/dataInterfaces.go index 9209d939cb4..5f701081059 100644 --- a/common/persistence/dataInterfaces.go +++ b/common/persistence/dataInterfaces.go @@ -109,7 +109,7 @@ const ( TransferTaskTransferTargetWorkflowID = "20000000-0000-f000-f000-000000000001" // TransferTaskTransferTargetRunID is the the dummy run ID for transfer tasks of types // that do not have a target workflow - TransferTaskTypeTransferTargetRunID = "30000000-0000-f000-f000-000000000002" + TransferTaskTransferTargetRunID = "30000000-0000-f000-f000-000000000002" ) type ( diff --git a/docker/start.sh b/docker/start.sh index 3aecee24573..79757c44460 100644 --- a/docker/start.sh +++ b/docker/start.sh @@ -21,11 +21,11 @@ # THE SOFTWARE. setup_schema() { - SCHEMA_DIR=$CADENCE_HOME/schema/cadence/versioned + SCHEMA_DIR=$CADENCE_HOME/schema/cassandra/cadence/versioned $CADENCE_HOME/cadence-cassandra-tool --ep $CASSANDRA_SEEDS create -k $KEYSPACE --rf $RF $CADENCE_HOME/cadence-cassandra-tool --ep $CASSANDRA_SEEDS -k $KEYSPACE setup-schema -v 0.0 $CADENCE_HOME/cadence-cassandra-tool --ep $CASSANDRA_SEEDS -k $KEYSPACE update-schema -d $SCHEMA_DIR - VISIBILITY_SCHEMA_DIR=$CADENCE_HOME/schema/visibility/versioned + VISIBILITY_SCHEMA_DIR=$CADENCE_HOME/schema/cassandra/visibility/versioned $CADENCE_HOME/cadence-cassandra-tool --ep $CASSANDRA_SEEDS create -k $VISIBILITY_KEYSPACE --rf $RF $CADENCE_HOME/cadence-cassandra-tool --ep $CASSANDRA_SEEDS -k $VISIBILITY_KEYSPACE setup-schema -v 0.0 $CADENCE_HOME/cadence-cassandra-tool --ep $CASSANDRA_SEEDS -k $VISIBILITY_KEYSPACE update-schema -d $VISIBILITY_SCHEMA_DIR diff --git a/schema/README.md b/schema/cassandra/README.md similarity index 100% rename from schema/README.md rename to schema/cassandra/README.md diff --git a/schema/cadence/keyspace.cql b/schema/cassandra/cadence/keyspace.cql similarity index 100% rename from schema/cadence/keyspace.cql rename to schema/cassandra/cadence/keyspace.cql diff --git a/schema/cadence/schema.cql b/schema/cassandra/cadence/schema.cql similarity index 100% rename from schema/cadence/schema.cql rename to schema/cassandra/cadence/schema.cql diff --git a/schema/cadence/versioned/v0.1/base.cql b/schema/cassandra/cadence/versioned/v0.1/base.cql similarity index 100% rename from schema/cadence/versioned/v0.1/base.cql rename to schema/cassandra/cadence/versioned/v0.1/base.cql diff --git a/schema/cadence/versioned/v0.1/manifest.json b/schema/cassandra/cadence/versioned/v0.1/manifest.json similarity index 100% rename from schema/cadence/versioned/v0.1/manifest.json rename to schema/cassandra/cadence/versioned/v0.1/manifest.json diff --git a/schema/cadence/versioned/v0.10/event_batch_version.cql b/schema/cassandra/cadence/versioned/v0.10/event_batch_version.cql similarity index 100% rename from schema/cadence/versioned/v0.10/event_batch_version.cql rename to schema/cassandra/cadence/versioned/v0.10/event_batch_version.cql diff --git a/schema/cadence/versioned/v0.10/manifest.json b/schema/cassandra/cadence/versioned/v0.10/manifest.json similarity index 100% rename from schema/cadence/versioned/v0.10/manifest.json rename to schema/cassandra/cadence/versioned/v0.10/manifest.json diff --git a/schema/cadence/versioned/v0.11/manifest.json b/schema/cassandra/cadence/versioned/v0.11/manifest.json similarity index 100% rename from schema/cadence/versioned/v0.11/manifest.json rename to schema/cassandra/cadence/versioned/v0.11/manifest.json diff --git a/schema/cadence/versioned/v0.11/workflow_retry.cql b/schema/cassandra/cadence/versioned/v0.11/workflow_retry.cql similarity index 100% rename from schema/cadence/versioned/v0.11/workflow_retry.cql rename to schema/cassandra/cadence/versioned/v0.11/workflow_retry.cql diff --git a/schema/cadence/versioned/v0.2/add_buffered_events.cql b/schema/cassandra/cadence/versioned/v0.2/add_buffered_events.cql similarity index 100% rename from schema/cadence/versioned/v0.2/add_buffered_events.cql rename to schema/cassandra/cadence/versioned/v0.2/add_buffered_events.cql diff --git a/schema/cadence/versioned/v0.2/add_sticky_tasklist.cql b/schema/cassandra/cadence/versioned/v0.2/add_sticky_tasklist.cql similarity index 100% rename from schema/cadence/versioned/v0.2/add_sticky_tasklist.cql rename to schema/cassandra/cadence/versioned/v0.2/add_sticky_tasklist.cql diff --git a/schema/cadence/versioned/v0.2/add_wf_timeout.cql b/schema/cassandra/cadence/versioned/v0.2/add_wf_timeout.cql similarity index 100% rename from schema/cadence/versioned/v0.2/add_wf_timeout.cql rename to schema/cassandra/cadence/versioned/v0.2/add_wf_timeout.cql diff --git a/schema/cadence/versioned/v0.2/fail_decision_mutable_state.cql b/schema/cassandra/cadence/versioned/v0.2/fail_decision_mutable_state.cql similarity index 100% rename from schema/cadence/versioned/v0.2/fail_decision_mutable_state.cql rename to schema/cassandra/cadence/versioned/v0.2/fail_decision_mutable_state.cql diff --git a/schema/cadence/versioned/v0.2/manifest.json b/schema/cassandra/cadence/versioned/v0.2/manifest.json similarity index 100% rename from schema/cadence/versioned/v0.2/manifest.json rename to schema/cassandra/cadence/versioned/v0.2/manifest.json diff --git a/schema/cadence/versioned/v0.3/add_client_version.cql b/schema/cassandra/cadence/versioned/v0.3/add_client_version.cql similarity index 100% rename from schema/cadence/versioned/v0.3/add_client_version.cql rename to schema/cassandra/cadence/versioned/v0.3/add_client_version.cql diff --git a/schema/cadence/versioned/v0.3/add_last_first_event_id.cql b/schema/cassandra/cadence/versioned/v0.3/add_last_first_event_id.cql similarity index 100% rename from schema/cadence/versioned/v0.3/add_last_first_event_id.cql rename to schema/cassandra/cadence/versioned/v0.3/add_last_first_event_id.cql diff --git a/schema/cadence/versioned/v0.3/manifest.json b/schema/cassandra/cadence/versioned/v0.3/manifest.json similarity index 100% rename from schema/cadence/versioned/v0.3/manifest.json rename to schema/cassandra/cadence/versioned/v0.3/manifest.json diff --git a/schema/cadence/versioned/v0.4/add_signal_decision.cql b/schema/cassandra/cadence/versioned/v0.4/add_signal_decision.cql similarity index 100% rename from schema/cadence/versioned/v0.4/add_signal_decision.cql rename to schema/cassandra/cadence/versioned/v0.4/add_signal_decision.cql diff --git a/schema/cadence/versioned/v0.4/add_tasklist_kind.cql b/schema/cassandra/cadence/versioned/v0.4/add_tasklist_kind.cql similarity index 100% rename from schema/cadence/versioned/v0.4/add_tasklist_kind.cql rename to schema/cassandra/cadence/versioned/v0.4/add_tasklist_kind.cql diff --git a/schema/cadence/versioned/v0.4/manifest.json b/schema/cassandra/cadence/versioned/v0.4/manifest.json similarity index 100% rename from schema/cadence/versioned/v0.4/manifest.json rename to schema/cassandra/cadence/versioned/v0.4/manifest.json diff --git a/schema/cadence/versioned/v0.5/add_domain_config_version.cql b/schema/cassandra/cadence/versioned/v0.5/add_domain_config_version.cql similarity index 100% rename from schema/cadence/versioned/v0.5/add_domain_config_version.cql rename to schema/cassandra/cadence/versioned/v0.5/add_domain_config_version.cql diff --git a/schema/cadence/versioned/v0.5/add_replication_config.cql b/schema/cassandra/cadence/versioned/v0.5/add_replication_config.cql similarity index 100% rename from schema/cadence/versioned/v0.5/add_replication_config.cql rename to schema/cassandra/cadence/versioned/v0.5/add_replication_config.cql diff --git a/schema/cadence/versioned/v0.5/add_target_child_workflow_only_to_transfer_task.cql b/schema/cassandra/cadence/versioned/v0.5/add_target_child_workflow_only_to_transfer_task.cql similarity index 100% rename from schema/cadence/versioned/v0.5/add_target_child_workflow_only_to_transfer_task.cql rename to schema/cassandra/cadence/versioned/v0.5/add_target_child_workflow_only_to_transfer_task.cql diff --git a/schema/cadence/versioned/v0.5/manifest.json b/schema/cassandra/cadence/versioned/v0.5/manifest.json similarity index 100% rename from schema/cadence/versioned/v0.5/manifest.json rename to schema/cassandra/cadence/versioned/v0.5/manifest.json diff --git a/schema/cadence/versioned/v0.6/add_shard_cluster_ack_level.cql b/schema/cassandra/cadence/versioned/v0.6/add_shard_cluster_ack_level.cql similarity index 100% rename from schema/cadence/versioned/v0.6/add_shard_cluster_ack_level.cql rename to schema/cassandra/cadence/versioned/v0.6/add_shard_cluster_ack_level.cql diff --git a/schema/cadence/versioned/v0.6/history_replication_task.cql b/schema/cassandra/cadence/versioned/v0.6/history_replication_task.cql similarity index 100% rename from schema/cadence/versioned/v0.6/history_replication_task.cql rename to schema/cassandra/cadence/versioned/v0.6/history_replication_task.cql diff --git a/schema/cadence/versioned/v0.6/manifest.json b/schema/cassandra/cadence/versioned/v0.6/manifest.json similarity index 100% rename from schema/cadence/versioned/v0.6/manifest.json rename to schema/cassandra/cadence/versioned/v0.6/manifest.json diff --git a/schema/cadence/versioned/v0.7/buffered_replication_task.cql b/schema/cassandra/cadence/versioned/v0.7/buffered_replication_task.cql similarity index 100% rename from schema/cadence/versioned/v0.7/buffered_replication_task.cql rename to schema/cassandra/cadence/versioned/v0.7/buffered_replication_task.cql diff --git a/schema/cadence/versioned/v0.7/failover_version_persistence.cql b/schema/cassandra/cadence/versioned/v0.7/failover_version_persistence.cql similarity index 100% rename from schema/cadence/versioned/v0.7/failover_version_persistence.cql rename to schema/cassandra/cadence/versioned/v0.7/failover_version_persistence.cql diff --git a/schema/cadence/versioned/v0.7/manifest.json b/schema/cassandra/cadence/versioned/v0.7/manifest.json similarity index 100% rename from schema/cadence/versioned/v0.7/manifest.json rename to schema/cassandra/cadence/versioned/v0.7/manifest.json diff --git a/schema/cadence/versioned/v0.7/retry_policy.cql b/schema/cassandra/cadence/versioned/v0.7/retry_policy.cql similarity index 100% rename from schema/cadence/versioned/v0.7/retry_policy.cql rename to schema/cassandra/cadence/versioned/v0.7/retry_policy.cql diff --git a/schema/cadence/versioned/v0.8/domain_notification.cql b/schema/cassandra/cadence/versioned/v0.8/domain_notification.cql similarity index 100% rename from schema/cadence/versioned/v0.8/domain_notification.cql rename to schema/cassandra/cadence/versioned/v0.8/domain_notification.cql diff --git a/schema/cadence/versioned/v0.8/manifest.json b/schema/cassandra/cadence/versioned/v0.8/manifest.json similarity index 100% rename from schema/cadence/versioned/v0.8/manifest.json rename to schema/cassandra/cadence/versioned/v0.8/manifest.json diff --git a/schema/cadence/versioned/v0.9/domain_data.cql b/schema/cassandra/cadence/versioned/v0.9/domain_data.cql similarity index 100% rename from schema/cadence/versioned/v0.9/domain_data.cql rename to schema/cassandra/cadence/versioned/v0.9/domain_data.cql diff --git a/schema/cadence/versioned/v0.9/manifest.json b/schema/cassandra/cadence/versioned/v0.9/manifest.json similarity index 100% rename from schema/cadence/versioned/v0.9/manifest.json rename to schema/cassandra/cadence/versioned/v0.9/manifest.json diff --git a/schema/cadence/versioned/v0.9/transfer_timestamp.cql b/schema/cassandra/cadence/versioned/v0.9/transfer_timestamp.cql similarity index 100% rename from schema/cadence/versioned/v0.9/transfer_timestamp.cql rename to schema/cassandra/cadence/versioned/v0.9/transfer_timestamp.cql diff --git a/schema/visibility/keyspace.cql b/schema/cassandra/visibility/keyspace.cql similarity index 100% rename from schema/visibility/keyspace.cql rename to schema/cassandra/visibility/keyspace.cql diff --git a/schema/visibility/schema.cql b/schema/cassandra/visibility/schema.cql similarity index 100% rename from schema/visibility/schema.cql rename to schema/cassandra/visibility/schema.cql diff --git a/schema/visibility/versioned/v0.1/base.cql b/schema/cassandra/visibility/versioned/v0.1/base.cql similarity index 100% rename from schema/visibility/versioned/v0.1/base.cql rename to schema/cassandra/visibility/versioned/v0.1/base.cql diff --git a/schema/visibility/versioned/v0.1/manifest.json b/schema/cassandra/visibility/versioned/v0.1/manifest.json similarity index 100% rename from schema/visibility/versioned/v0.1/manifest.json rename to schema/cassandra/visibility/versioned/v0.1/manifest.json diff --git a/schema/visibility/versioned/v0.2/manifest.json b/schema/cassandra/visibility/versioned/v0.2/manifest.json similarity index 100% rename from schema/visibility/versioned/v0.2/manifest.json rename to schema/cassandra/visibility/versioned/v0.2/manifest.json diff --git a/schema/visibility/versioned/v0.2/reduce_open_workflow_tombstones.cql b/schema/cassandra/visibility/versioned/v0.2/reduce_open_workflow_tombstones.cql similarity index 100% rename from schema/visibility/versioned/v0.2/reduce_open_workflow_tombstones.cql rename to schema/cassandra/visibility/versioned/v0.2/reduce_open_workflow_tombstones.cql diff --git a/tools/cassandra/README.md b/tools/cassandra/README.md index e0f85e05d2e..1ad9233a06d 100644 --- a/tools/cassandra/README.md +++ b/tools/cassandra/README.md @@ -22,20 +22,20 @@ See https://www.ecyrd.com/cassandracalculator for an easy way to determine how m ## Setting up schema on a new cluster manually ``` ./cadence-cassandra-tool -ep 127.0.0.1 -k cadence setup-schema -v 0.0 -- this sets up just the schema version tables with initial version of 0.0 -./cadence-cassandra-tool -ep 127.0.0.1 -k cadence update-schema -d ./schema/cadence/versioned -- upgrades your schema to the latest version +./cadence-cassandra-tool -ep 127.0.0.1 -k cadence update-schema -d ./schema/cassandra/cadence/versioned -- upgrades your schema to the latest version ./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility setup-schema -v 0.0 -- this sets up just the schema version tables with initial version of 0.0 for visibility -./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility update-schema -d ./schema/visibility/versioned -- upgrades your schema to the latest version for visibility +./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility update-schema -d ./schema/cassandra/visibility/versioned -- upgrades your schema to the latest version for visibility ``` ## Updating schema on an existing cluster You can only upgrade to a new version after the initial setup done above. ``` -./cadence-cassandra-tool -ep 127.0.0.1 -k cadence update-schema -d ./schema/cadence/versioned -v x.x -y -- executes a dryrun of upgrade to version x.x -./cadence-cassandra-tool -ep 127.0.0.1 -k cadence update-schema -d ./schema/cadence/versioned -v x.x -- actually executes the upgrade to version x.x +./cadence-cassandra-tool -ep 127.0.0.1 -k cadence update-schema -d ./schema/cassandra/cadence/versioned -v x.x -y -- executes a dryrun of upgrade to version x.x +./cadence-cassandra-tool -ep 127.0.0.1 -k cadence update-schema -d ./schema/cassandra/cadence/versioned -v x.x -- actually executes the upgrade to version x.x -./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility update-schema -d ./schema/visibility/versioned -v x.x -y -- executes a dryrun of upgrade to version x.x -./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility update-schema -d ./schema/visibility/versioned -v x.x -- actually executes the upgrade to version x.x +./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility update-schema -d ./schema/cassandra/visibility/versioned -v x.x -y -- executes a dryrun of upgrade to version x.x +./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility update-schema -d ./schema/cassandra/visibility/versioned -v x.x -- actually executes the upgrade to version x.x ``` diff --git a/tools/cassandra/updateTask_test.go b/tools/cassandra/updateTask_test.go index f777e3bc33d..2c1bada53b3 100644 --- a/tools/cassandra/updateTask_test.go +++ b/tools/cassandra/updateTask_test.go @@ -122,7 +122,7 @@ func (s *UpdateSchemaTestSuite) TestDryrun() { s.Nil(err) defer client.Close() - dir := "../../schema/cadence/versioned" + dir := "../../schema/cassandra/cadence/versioned" RunTool([]string{"./tool", "-k", s.keyspace, "-q", "setup-schema", "-v", "0.0"}) RunTool([]string{"./tool", "-k", s.keyspace, "-q", "update-schema", "-d", dir}) diff --git a/tools/cassandra/version.go b/tools/cassandra/version.go index feb660b8076..9bf31884e40 100644 --- a/tools/cassandra/version.go +++ b/tools/cassandra/version.go @@ -131,11 +131,11 @@ func getExpectedVersion(dir string) (string, error) { // rollback, the code version (expected version) would fall lower than the actual version in // cassandra. func VerifyCompatibleVersion(cfg config.Cassandra, rootPath string) error { - schemaPath := path.Join(rootPath, "schema/cadence/versioned") + schemaPath := path.Join(rootPath, "schema/cassandra/cadence/versioned") if err := checkCompatibleVersion(cfg, cfg.Keyspace, schemaPath); err != nil { return err } - schemaPath = path.Join(rootPath, "schema/visibility/versioned") + schemaPath = path.Join(rootPath, "schema/cassandra/visibility/versioned") return checkCompatibleVersion(cfg, cfg.VisibilityKeyspace, schemaPath) } diff --git a/tools/cassandra/version_test.go b/tools/cassandra/version_test.go index 4634e4b88e6..6d7388fa897 100644 --- a/tools/cassandra/version_test.go +++ b/tools/cassandra/version_test.go @@ -168,8 +168,8 @@ func (s *VersionTestSuite) TestVerifyCompatibleVersion() { _, filename, _, ok := runtime.Caller(0) s.True(ok) root := path.Dir(path.Dir(path.Dir(filename))) - cqlFile := path.Join(root, "schema/cadence/schema.cql") - visCqlFile := path.Join(root, "schema/visibility/schema.cql") + cqlFile := path.Join(root, "schema/cassandra/cadence/schema.cql") + visCqlFile := path.Join(root, "schema/cassandra/visibility/schema.cql") defer s.createKeyspace(keyspace)() defer s.createKeyspace(visKeyspace)()