Skip to content

Commit 025b73e

Browse files
authored
Merge pull request #236 from datastax/issue/build-stability-fixes
Build stability fixes
2 parents 23de805 + ea959cb commit 025b73e

File tree

13 files changed

+77
-22
lines changed

13 files changed

+77
-22
lines changed

SIT/environment.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ _testDockerNetwork() {
8181
}
8282

8383
_testDockerCassandra() {
84-
dockerPs=$(docker ps -a | awk '{if ($NF == "'${DOCKER_CASS}'") {print "yes"}}')
84+
dockerPs=$(docker ps --all --filter "name=${DOCKER_CASS}" --format "{{.Status}}" | awk '{if ($1 == "Up") {print "yes"}}')
8585
if [ "$dockerPs" != "yes" ]; then
8686
echo "no"
8787
return
@@ -154,7 +154,7 @@ _dropKeyspaces() {
154154
}
155155

156156
_testDockerCDM() {
157-
dockerPs=$(docker ps -a | awk '{if ($NF == "'${DOCKER_CDM}'") {print "yes"}}')
157+
dockerPs=$(docker ps --all --filter "name=${DOCKER_CDM}" --format "{{.Status}}" | awk '{if ($1 == "Up") {print "yes"}}')
158158
if [ "$dockerPs" != "yes" ]; then
159159
echo "no"
160160
else
@@ -228,8 +228,17 @@ _Setup() {
228228

229229
if [ "$(_testDockerCDM)" != "yes" ]; then
230230
dockerContainerVersion=datastax/cassandra-data-migrator:${CDM_VERSION}
231+
232+
# Uncomment the below 'docker build' lines when making docker changes to ensure you test the docker changes
233+
# Also comment the 'docker pull' line when 'docker build' is uncommented.
234+
# Note this ('docker build') should be done only when testing docker changes locally (i.e. Do not commit)
235+
# If you commit the 'docker build' step, the build will work but it will take too long as each time it will build
236+
# CDM docker image instead of just downloading from DockerHub.
231237
_info "Pulling latest Docker container for ${dockerContainerVersion}"
232238
docker pull ${dockerContainerVersion}
239+
# _info "Building latest Docker container for ${dockerContainerVersion}"
240+
# docker build -t ${dockerContainerVersion} ..
241+
233242
_info "Starting Docker container ${DOCKER_CASS}"
234243
docker run --name ${DOCKER_CDM} --network ${NETWORK_NAME} --ip ${SUBNET}.3 -e "CASS_USERNAME=${CASS_USERNAME}" -e "CASS_PASSWORD=${CASS_PASSWORD}" -e "CASS_CLUSTER=${DOCKER_CASS}" -d ${dockerContainerVersion}
235244
attempt=1
@@ -278,7 +287,7 @@ _Validate() {
278287
fi
279288

280289
if [ "$(_testDockerCassandra)" == "yes" ]; then
281-
_info "Cassandra Docker is valid"
290+
_info "Cassandra Docker is valid and running"
282291
else
283292
_warn "Cassandra Docker is invalid"
284293
invalid=1
@@ -292,7 +301,7 @@ _Validate() {
292301
fi
293302

294303
if [ "$(_testDockerCDM)" == "yes" ]; then
295-
_info "CDM Docker is valid"
304+
_info "CDM Docker is valid and running"
296305
else
297306
_warn "CDM Docker is invalid"
298307
invalid=1

SIT/features/01_constant_column/breakData.cql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,11 @@
1414

1515
DELETE FROM target.feature_constant_column WHERE key='key2' AND const1='abcd';
1616
UPDATE target.feature_constant_column SET value='value999' WHERE key='key3' AND const1='abcd';
17+
18+
# This upsert to origin will update the writetime on origin to be newer than target
19+
INSERT INTO origin.feature_constant_column(key,value) VALUES ('key1','valueA');
20+
INSERT INTO origin.feature_constant_column(key,value) VALUES ('key2','valueB');
21+
INSERT INTO origin.feature_constant_column(key,value) VALUES ('key3','valueC');
22+
1723
SELECT * FROM target.feature_constant_column;
1824

SIT/features/02_explode_map/breakData.cql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,11 @@ DELETE FROM target.feature_explode_map WHERE key='key2';
1414
UPDATE target.feature_explode_map SET value='value999' WHERE key='key3' AND fruit='apples';
1515
UPDATE target.feature_explode_map SET fruit_qty=999 WHERE key='key3' AND fruit='oranges';
1616
DELETE FROM target.feature_explode_map WHERE key='key3' AND fruit='kiwi';
17+
18+
# This upsert to origin will update the writetime on origin to be newer than target
19+
INSERT INTO origin.feature_explode_map(key,value,fruits) VALUES ('key1','valueA', {'apples': 3, 'oranges': 5, 'bananas': 2, 'grapes': 11});
20+
INSERT INTO origin.feature_explode_map(key,value,fruits) VALUES ('key2','valueB', {'apples': 4, 'oranges': 6, 'bananas': 3, 'pears': 7});
21+
INSERT INTO origin.feature_explode_map(key,value,fruits) VALUES ('key3','valueC', {'apples': 5, 'oranges': 7, 'bananas': 4, 'kiwi': 42});
22+
1723
SELECT * FROM target.feature_explode_map;
1824

SIT/features/03_codec/breakData.cql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,13 @@ UPDATE target.codec SET
1818
val_timestamp='2024-04-16 10:30:00+0000',
1919
val_decimal=999.1234
2020
WHERE key='key3';
21+
22+
# This upsert to origin will update the writetime on origin to be newer than target
23+
INSERT INTO origin.codec(key,val_int,val_bigint,val_timestamp,val_decimal,val_double)
24+
VALUES ('key1','1234' ,'9223372036854775807','040616110000', '3.14', '21474836470.7');
25+
INSERT INTO origin.codec(key,val_int,val_bigint,val_timestamp,val_decimal,val_double)
26+
VALUES ('key2','12345' ,'2147483648' ,'990616110000', '4.14', '21474836470.7');
27+
INSERT INTO origin.codec(key,val_int,val_bigint,val_timestamp,val_decimal,val_double)
28+
VALUES ('key3','123456','3141592653589793' ,'990616110000', '5.14', '21474836470.7');
29+
2130
SELECT * FROM target.codec;

SIT/features/06_partition_range/breakData.cql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,11 @@
1414

1515
DELETE FROM target.feature_partition_range WHERE key='key1';
1616
UPDATE target.feature_partition_range SET value='value999' WHERE key='key2';
17+
18+
# This upsert to origin will update the writetime on origin to be newer than target
19+
INSERT INTO origin.feature_partition_range(key,value) VALUES ('key1','valueA');
20+
INSERT INTO origin.feature_partition_range(key,value) VALUES ('key2','valueB');
21+
INSERT INTO origin.feature_partition_range(key,value) VALUES ('key3','valueC');
22+
1723
SELECT * FROM target.feature_partition_range;
1824

SIT/regression/01_explode_map_with_constants/breakData.cql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,10 @@ DELETE FROM target.feature_explode_map_with_constants WHERE const1='abcd' AND co
1616
UPDATE target.feature_explode_map_with_constants SET time=7398730800000 WHERE const1='abcd' AND const2=1234 AND key='key3' AND fruit='apples';
1717
UPDATE target.feature_explode_map_with_constants SET fruit_qty=999 WHERE const1='abcd' AND const2=1234 AND key='key3' AND fruit='oranges';
1818
DELETE FROM target.feature_explode_map_with_constants WHERE const1='abcd' AND const2=1234 AND key='key3' AND fruit='kiwi';
19+
20+
# This upsert to origin will update the writetime on origin to be newer than target
21+
INSERT INTO origin.feature_explode_map_with_constants(key,time,fruits) VALUES ('key1','1087383600000', {'apples': 3, 'oranges': 5, 'bananas': 2, 'grapes': 11});
22+
INSERT INTO origin.feature_explode_map_with_constants(key,time,fruits) VALUES ('key2','1087383600000', {'apples': 4, 'oranges': 6, 'bananas': 3, 'pears': 7});
23+
INSERT INTO origin.feature_explode_map_with_constants(key,time,fruits) VALUES ('key3','1087383600000', {'apples': 5, 'oranges': 7, 'bananas': 4, 'kiwi': 42});
24+
1925
SELECT * FROM target.feature_explode_map_with_constants;

SIT/regression/02_ColumnRenameWithConstantsAndExplode/breakData.cql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
limitations under the License.
1313
*/
1414

15-
DELETE FROM target.column_rename_with_constants_and_explode WHERE customer='CUSTOMER' AND year=2023 AND key_name='key2';
16-
UPDATE target.column_rename_with_constants_and_explode SET fruit_qty=999 WHERE customer='CUSTOMER' AND year=2023 AND key_name='key3' AND fruit='oranges';
17-
DELETE FROM target.column_rename_with_constants_and_explode WHERE customer='CUSTOMER' AND year=2023 AND key_name='key3' AND fruit='kiwi';
15+
DELETE FROM target.column_rename_with_constants_and_explode WHERE customer='CUSTOMER' AND year=2023 AND key_name='key2';
16+
UPDATE target.column_rename_with_constants_and_explode SET fruit_qty=999 WHERE customer='CUSTOMER' AND year=2023 AND key_name='key3' AND fruit='oranges';
17+
DELETE FROM target.column_rename_with_constants_and_explode WHERE customer='CUSTOMER' AND year=2023 AND key_name='key3' AND fruit='kiwi';
1818
SELECT * FROM target.column_rename_with_constants_and_explode;
1919

SIT/regression/03_performance/breakData.cql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
limitations under the License.
1313
*/
1414

15-
DELETE FROM target.regression_performance WHERE pk_id = 600;
15+
DELETE FROM target.regression_performance WHERE pk_id = 600;
1616
SELECT * FROM target.regression_performance WHERE pk_id >= 400 AND pk_id < 700 ALLOW FILTERING;

SIT/regression/03_performance/execute.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,8 @@ dsbulk load -url $workingDir/data.csv -h $CASS_CLUSTER -u $CASS_USERNAME -p $CAS
2828
dsbulk load -url $workingDir/data_break.csv -h $CASS_CLUSTER -u $CASS_USERNAME -p $CASS_PASSWORD -k target -t regression_performance
2929
cqlsh -u $CASS_USERNAME -p $CASS_PASSWORD $CASS_CLUSTER -f $workingDir/breakData.cql > $workingDir/breakData.out 2> $workingDir/breakData.err
3030

31+
# This upsert to origin will update the writetime on origin to be newer than target
32+
dsbulk load -url $workingDir/data.csv -h $CASS_CLUSTER -u $CASS_USERNAME -p $CASS_PASSWORD -k origin -t regression_performance
33+
3134
/local/cdm.sh -f cdm.txt -s fixData -d "$workingDir" > cdm.fixData.out 2>cdm.fixData.err
3235
/local/cdm-assert.sh -f cdm.fixData.out -a cdm.fixData.assert -d "$workingDir"

SIT/regression/03_performance/migrate.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# limitations under the License.
1313
#
1414

15-
1615
spark.cdm.connect.origin.host cdm-sit-cass
1716
spark.cdm.connect.target.host cdm-sit-cass
1817

0 commit comments

Comments
 (0)