Skip to content

Commit 3222e01

Browse files
Add REPLICATION parameter to Cassandra schema script (jaegertracing#6582)
## Which problem is this PR solving? Resoles jaegertracing#2618 ## Description of the changes - The addition of the REPLICATION variable allows users to directly specify a custom replication configuration for Cassandra, overriding the default behavior. ## How was this change tested? - i used the make test command provided by the jaeger ## Checklist - [*] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [X] I have signed all commits - [ ] I have added unit tests for the new functionality - [X] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `npm run lint` and `npm run test` --------- Signed-off-by: asim <[email protected]> Signed-off-by: Yuri Shkuro <[email protected]> Co-authored-by: Yuri Shkuro <[email protected]>
1 parent b689a86 commit 3222e01

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

plugin/storage/cassandra/schema/create.sh

+16-7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ function usage {
1414
>&2 echo " TRACE_TTL - time to live for trace data, in seconds (default: 172800, 2 days)"
1515
>&2 echo " DEPENDENCIES_TTL - time to live for dependencies data, in seconds (default: 0, no TTL)"
1616
>&2 echo " KEYSPACE - keyspace (default: jaeger_v1_{datacenter})"
17+
>&2 echo " REPLICATION - complete replication configuration (if set, overrides REPLICATION_FACTOR and DATACENTER)"
1718
>&2 echo " REPLICATION_FACTOR - replication factor for prod (default: 2 for prod, 1 for test)"
1819
>&2 echo " VERSION - Cassandra backend version, 3 or 4 (default: 4). Ignored if template is provided."
1920
>&2 echo ""
@@ -47,14 +48,22 @@ fi
4748
if [[ "$MODE" == "" ]]; then
4849
usage "missing MODE parameter"
4950
elif [[ "$MODE" == "prod" ]]; then
50-
if [[ "$DATACENTER" == "" ]]; then usage "missing DATACENTER parameter for prod mode"; fi
51-
datacenter=$DATACENTER
52-
replication_factor=${REPLICATION_FACTOR:-2}
53-
replication="{'class': 'NetworkTopologyStrategy', '$datacenter': '${replication_factor}' }"
51+
if [[ -n "$REPLICATION" ]]; then
52+
replication="$REPLICATION"
53+
else
54+
if [[ "$DATACENTER" == "" ]]; then usage "missing DATACENTER parameter for prod mode"; fi
55+
datacenter=$DATACENTER
56+
replication_factor=${REPLICATION_FACTOR:-2}
57+
replication="{'class': 'NetworkTopologyStrategy', '$datacenter': '${replication_factor}' }"
58+
fi
5459
elif [[ "$MODE" == "test" ]]; then
55-
datacenter=${DATACENTER:-'test'}
56-
replication_factor=${REPLICATION_FACTOR:-1}
57-
replication="{'class': 'SimpleStrategy', 'replication_factor': '${replication_factor}'}"
60+
if [[ -n "$REPLICATION" ]]; then
61+
replication="$REPLICATION"
62+
else
63+
datacenter=${DATACENTER:-'test'}
64+
replication_factor=${REPLICATION_FACTOR:-1}
65+
replication="{'class': 'SimpleStrategy', 'replication_factor': '${replication_factor}'}"
66+
fi
5867
else
5968
usage "invalid MODE=$MODE, expecting 'prod' or 'test'"
6069
fi

0 commit comments

Comments
 (0)