mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-25 09:11:10 +00:00
38 lines
1.9 KiB
Plaintext
38 lines
1.9 KiB
Plaintext
> CREATE KEYSPACE ks
|
|
> WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 1};
|
|
OK
|
|
> USE ks;
|
|
OK
|
|
>
|
|
> create table tb2 (pk int, ck int, i1 int, PRIMARY KEY (pk, ck)) with cdc = {'enabled': true, 'preimage': true, 'postimage': true, 'delta': 'keys'};
|
|
OK
|
|
> -- Should add 3 rows (preimage + postimage + delta). Delta has only key columns and "pk" + "ck"
|
|
> insert into tb2 (pk, ck, i1) VALUES (2, 22, 222) USING TTL 2222;
|
|
OK
|
|
> select "cdc$batch_seq_no", "cdc$operation", "cdc$ttl", pk, ck, i1 from tb2_scylla_cdc_log where pk = 2 and ck = 22 allow filtering;
|
|
+--------------------+-----------------+-----------+------+------+------+
|
|
| cdc$batch_seq_no | cdc$operation | cdc$ttl | pk | ck | i1 |
|
|
|--------------------+-----------------+-----------+------+------+------|
|
|
| 0 | 2 | 2222 | 2 | 22 | null |
|
|
| 1 | 9 | null | 2 | 22 | 222 |
|
|
+--------------------+-----------------+-----------+------+------+------+
|
|
>
|
|
> alter table tb2 with cdc = {'enabled': true, 'preimage': true, 'postimage': true, 'delta': 'full'};
|
|
OK
|
|
> -- Should add 3 rows (preimage + postimage + delta)
|
|
> insert into tb2 (pk, ck, i1) VALUES (3, 33, 333) USING TTL 3333;
|
|
OK
|
|
> select "cdc$batch_seq_no", "cdc$operation", "cdc$ttl", pk, ck, i1 from tb2_scylla_cdc_log where pk = 3 and ck = 33 allow filtering;
|
|
+--------------------+-----------------+-----------+------+------+------+
|
|
| cdc$batch_seq_no | cdc$operation | cdc$ttl | pk | ck | i1 |
|
|
|--------------------+-----------------+-----------+------+------+------|
|
|
| 0 | 2 | 3333 | 3 | 33 | 333 |
|
|
| 1 | 9 | null | 3 | 33 | 333 |
|
|
+--------------------+-----------------+-----------+------+------+------+
|
|
> drop table tb2;
|
|
OK
|
|
>
|
|
> -- cleanup
|
|
> DROP KEYSPACE ks;
|
|
OK
|