From 67961b90acecb38e9f308dd6fa08f2bae05911cb Mon Sep 17 00:00:00 2001 From: Jun Guo Date: Wed, 27 Nov 2019 18:26:32 -0500 Subject: [PATCH] Improve migration script - continue migration if number of rows changed during migration - improve the sample command and remove unused TTL since it will be copied from old table Signed-off-by: Jun Guo --- CHANGELOG.md | 4 ++-- plugin/storage/cassandra/schema/migration/V002toV003.sh | 9 ++------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ccb07a2bf66..572c6ac0c61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,8 +47,8 @@ Changes by Version 1. You will need to run below command on the host you can use `cqlsh` to connect the the cassandra contact point ``` - KEYSPACE=test_keyspace TIMEOUT=1000 CQL_CMD='cqlsh host 9042 -u test_user -p test_password' bash - ./plugin/storage/cassandra/schema/migration/v002tov003.sh + KEYSPACE=jaeger_v1 CQL_CMD='cqlsh host 9042 -u test_user -p test_password --request-timeout=3000' + bash ./v002tov003.sh ``` The script will create new table `operation_names_v2` and migrate data from the old table. `spanKind` column will be empty for those data. diff --git a/plugin/storage/cassandra/schema/migration/V002toV003.sh b/plugin/storage/cassandra/schema/migration/V002toV003.sh index 58c46fd9370..b0a531b2995 100644 --- a/plugin/storage/cassandra/schema/migration/V002toV003.sh +++ b/plugin/storage/cassandra/schema/migration/V002toV003.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Create a new operation_names_v2 table and copy all data from operation_names table -# Sample usage: KEYSPACE=jaeger_v1 TIMEOUT=1000 CQL_CMD='cqlsh host 9042 -u test_user -p test_password' bash +# Sample usage: KEYSPACE=jaeger_v1 CQL_CMD='cqlsh host 9042 -u test_user -p test_password --request-timeout=3000' bash # ./v002tov003.sh set -euo pipefail @@ -9,7 +9,7 @@ set -euo pipefail function usage { >&2 echo "Error: $1" >&2 echo "" - >&2 echo "Usage: KEYSPACE={keyspace} TTL={ttl} CQL_CMD={cql_cmd}$0" + >&2 echo "Usage: KEYSPACE={keyspace} CQL_CMD={cql_cmd} $0" >&2 echo "" >&2 echo "The following parameters can be set via environment:" >&2 echo " KEYSPACE - keyspace" @@ -64,11 +64,6 @@ fi csv_rows=$(wc -l ${old_table}.csv | tr -dc '0-9') -if [[ ${row_count} -ne ${csv_rows} ]]; then - echo "Number of rows: $csv_rows in file is not equal to number of rows: $row_count in cassandra" - exit 1 -fi - echo "Generating data for new table..." while IFS="," read service_name operation_name; do echo "$service_name,,$operation_name"