Skip to content

Commit a3cbb77

Browse files
authored
Merge pull request #118 from datastax/issue/CDM-27
CDM-27 implementing TTL/Writettime tests and SIT, and fixing problems
2 parents b43bd39 + 6efed59 commit a3cbb77

23 files changed

+472
-64
lines changed

SIT/common.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
DOCKER_CASS=cdm-sit-cass
2-
DOCKER_CDM=cdm-sit-cdm
3-
CASS_USERNAME=cassandra
4-
CASS_PASSWORD=cassandra
5-
KEYSPACES="source target"
6-
CDM_DIRECTORY=/local
7-
CDM_JARFILE=cassandra-data-migrator.jar
1+
export DOCKER_CASS=cdm-sit-cass
2+
export DOCKER_CDM=cdm-sit-cdm
3+
export CASS_USERNAME=cassandra
4+
export CASS_PASSWORD=cassandra
5+
export KEYSPACES="source target"
6+
export CDM_DIRECTORY=/local
7+
export CDM_JARFILE=cassandra-data-migrator.jar
88

99
_info() {
1010
echo "INFO $*"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
# We need TTL to go down by at least 1 second, e.g. make 60000 to 59999
3+
sleep 1
4+
docker exec ${DOCKER_CASS} /bin/bash -c "cqlsh -u $CASS_USERNAME -p $CASS_PASSWORD -f $testDir/expected.cql | tr -d ' ' | cut -c1-46"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
DELETE FROM target.smoke_ttl_writetime USING TIMESTAMP 1087383780000000 WHERE key='record4'; -- 11:00:03
3+
INSERT INTO source.smoke_ttl_writetime(key, t_col1) VALUES ('record4','AAAA') USING TTL 4000 AND TIMESTAMP 1087384200000000; -- 11:10:00
4+
INSERT INTO source.smoke_ttl_writetime(key,tw_col2) VALUES ('record4','BBBB') USING TTL 4000 AND TIMESTAMP 1087384200000000; -- 11:10:00
5+
INSERT INTO source.smoke_ttl_writetime(key, w_col3) VALUES ('record4','CCCC') USING TTL 4000 AND TIMESTAMP 1087384200000000; -- 11:10:00
6+
INSERT INTO source.smoke_ttl_writetime(key, col4) VALUES ('record4','DDDD') USING TTL 4000 AND TIMESTAMP 1087384200000000; -- 11:10:00
7+
8+
9+
-- t_col1 is TTL only, so the TTL value should be picked by the diff, but not the writetime
10+
INSERT INTO source.smoke_ttl_writetime(key, t_col1) VALUES ('record5','A---') USING TTL 700000 AND TIMESTAMP 1087384200000000; -- 11:10:00
11+
INSERT INTO source.smoke_ttl_writetime(key, tw_col2) VALUES ('record5','B---') USING TTL 700000 AND TIMESTAMP 1087384200000000; -- 11:10:00
12+
13+
-- t_col1 is TTL only. Its timestamp will update correctly, but the change will be written with previous timestamps
14+
-- from tw_col2 and w_col3, which means the change will be lost
15+
INSERT INTO source.smoke_ttl_writetime(key, t_col1) VALUES ('record8','A---') USING TTL 700000 AND TIMESTAMP 1087384200000000; -- 11:10:00
16+
17+
18+
-- w_col3 is Writetime only, so the writetime value should be picked by the diff, but not the diff
19+
INSERT INTO source.smoke_ttl_writetime(key, w_col3) VALUES ('record6','C---') USING TTL 700000 AND TIMESTAMP 1087384200000000; -- 11:10:00
20+
21+
-- tw_col2 is TTL and Writetime, so both changes should be propatated by the diff
22+
INSERT INTO source.smoke_ttl_writetime(key, tw_col2) VALUES ('record7','B---') USING TTL 700000 AND TIMESTAMP 1087384200000000; -- 11:10:00
23+
24+
25+
26+
SELECT * FROM target.smoke_ttl_writetime;
27+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Read Record Count: 8
2+
Mismatch Record Count: 4
3+
Corrected Mismatch Record Count: 4
4+
Missing Record Count: 1
5+
Corrected Missing Record Count: 1
6+
Valid Record Count: 3
7+
Skipped Record Count: 0
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Read Record Count: 8
2+
Skipped Record Count: 0
3+
Write Record Count: 8
4+
Error Record Count: 0

SIT/smoke/03_ttl_writetime/cdm.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
migrateData datastax.astra.migrate.Migrate migrate.properties
2+
validateData datastax.astra.migrate.DiffData migrate.properties
3+
fixData datastax.astra.migrate.DiffData fix.properties
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Read Record Count: 8
2+
Mismatch Record Count: 0
3+
Corrected Mismatch Record Count: 0
4+
Missing Record Count: 0
5+
Corrected Missing Record Count: 0
6+
Valid Record Count: 8
7+
Skipped Record Count: 0

SIT/smoke/03_ttl_writetime/execute.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash -e
2+
3+
workingDir="$1"
4+
cd "$workingDir"
5+
6+
/local/cdm.sh -f cdm.txt -s migrateData -d "$workingDir" > cdm.migrateData.out 2>cdm.migrateData.err
7+
/local/cdm-assert.sh -f cdm.migrateData.out -a cdm.migrateData.assert -d "$workingDir"
8+
9+
/local/cdm.sh -f cdm.txt -s validateData -d "$workingDir" > cdm.validateData.out 2>cdm.validateData.err
10+
/local/cdm-assert.sh -f cdm.validateData.out -a cdm.validateData.assert -d "$workingDir"
11+
12+
cqlsh -u $CASS_USERNAME -p $CASS_PASSWORD $CASS_CLUSTER -f $workingDir/breakData.cql > $workingDir/breakData.out 2> $workingDir/breakData.err
13+
14+
/local/cdm.sh -f cdm.txt -s fixData -d "$workingDir" > cdm.fixData.out 2>cdm.fixData.err
15+
/local/cdm-assert.sh -f cdm.fixData.out -a cdm.fixData.assert -d "$workingDir"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SELECT key,t_col1,tw_col2,w_col3,col4, writetime(col4) as wt_col4, ttl(col4) as ttl_col4 FROM target.smoke_ttl_writetime;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
key|t_col1|tw_col2|w_col3|col4|wt_col4|ttl_col
3+
---------+--------+---------+--------+------+-
4+
record3|AAAA|BBBB|CCCC|DDDD|1087383720000000|5
5+
record5|A---|B---|CCCC|DDDD|1087384200000000|6
6+
record2|AAAA|BBBB|CCCC|DDDD|1087383720000000|5
7+
record6|AAAA|BBBB|C---|DDDD|1087384200000000|5
8+
record1|AAAA|BBBB|CCCC|DDDD|1087383720000000|5
9+
record8|AAAA|BBBB|CCCC|DDDD|1087383720000000|6
10+
record7|AAAA|B---|CCCC|DDDD|1087384200000000|6
11+
record4|AAAA|BBBB|CCCC|DDDD|1087384200000000|3
12+
13+
(8rows)

0 commit comments

Comments
 (0)