Files
scylladb/test/cql/cdc_batch_delete_postimage_test.result
Jan Ciolek d2ef55b12c test: use NetworkTopologyStrategy in all unit tests
As described in https://github.com/scylladb/scylladb/issues/8638,
we're moving away from `SimpleStrategy`, in the future
it will become deprecated.

We should remove all uses of it and replace them
with `NetworkTopologyStrategy`.

This change replaces `SimpleStrategy` with
`NetworkTopologyStrategy` in all unit tests,
or at least in the ones where it was reasonable to do so.
Some of the tests were written explicitly to test the
`SimpleStrategy` strategy, or changing the keyspace from
`SimpleStrategy` to `NetworkTopologyStrategy`.
These tests were left intact.
It's still a feature that is supported,
even if it's slowly getting deprecated.

The typical way to use `NetworkTopologyStrategy` is
to specify a replication factor for each datacenter.
This could be a bit cumbersome, we would have to fetch
the list of datacenters, set the repfactors, etc.

Luckily there is another way - we can just specify
a replication factor to use for or each existing
datacenter, like this:
```cql
CREATE KEYSPACE {} WITH REPLICATION =
{'class' : 'NetworkTopologyStrategy', 'replication_factor' : 1};
```

This makes the change rather straightforward - just replace all
instances of `'SimpleStrategy'', with `'NetworkTopologyStrategy'`.

Refs: https://github.com/scylladb/scylladb/issues/8638

Signed-off-by: Jan Ciolek <jan.ciolek@scylladb.com>

Closes #13990
2023-05-23 08:52:56 +03:00

54 lines
2.6 KiB
Plaintext

> -- Error messages contain a keyspace name. Make the output stable.
> CREATE KEYSPACE ks WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 1};
OK
> -- do range delete in batch
> create table ks.t (pk int, ck int, v int, primary key(pk, ck)) with cdc = {'enabled': true, 'preimage': true, 'postimage': true};
OK
>
> begin batch insert into ks.t (pk, ck, v) values (1, 1, 100); delete from ks.t where pk = 1 and ck >= 1 and ck <= 2; apply batch;
OK
>
> select "cdc$batch_seq_no", "cdc$operation", pk, ck, v from ks.t_scylla_cdc_log;
+--------------------+-----------------+------+------+------+
| cdc$batch_seq_no | cdc$operation | pk | ck | v |
|--------------------+-----------------+------+------+------|
| 0 | 2 | 1 | 1 | 100 |
| 1 | 5 | 1 | 1 | null |
| 2 | 7 | 1 | 2 | null |
+--------------------+-----------------+------+------+------+
>
> -- do pk delete in batch
> create table ks.t2 (pk int, ck int, v int, primary key(pk, ck)) with cdc = {'enabled': true, 'preimage': true, 'postimage': true};
OK
>
> begin batch insert into ks.t2 (pk, ck, v) values (1, 1, 100); delete from ks.t2 where pk = 1; apply batch;
OK
>
> select "cdc$batch_seq_no", "cdc$operation", pk, ck, v from ks.t2_scylla_cdc_log;
+--------------------+-----------------+------+------+------+
| cdc$batch_seq_no | cdc$operation | pk | ck | v |
|--------------------+-----------------+------+------+------|
| 0 | 2 | 1 | 1 | 100 |
| 1 | 4 | 1 | null | null |
+--------------------+-----------------+------+------+------+
>
> -- do range delete in batch, but not matcing ck
> create table ks.t3 (pk int, ck int, v int, primary key(pk, ck)) with cdc = {'enabled': true, 'preimage': true, 'postimage': true};
OK
>
> -- do range delete in batch
> begin batch insert into ks.t3 (pk, ck, v) values (1, 1, 100); delete from ks.t3 where pk = 1 and ck >= 2 and ck <= 3; apply batch;
OK
>
> select "cdc$batch_seq_no", "cdc$operation", pk, ck, v from ks.t3_scylla_cdc_log;
+--------------------+-----------------+------+------+------+
| cdc$batch_seq_no | cdc$operation | pk | ck | v |
|--------------------+-----------------+------+------+------|
| 0 | 2 | 1 | 1 | 100 |
| 1 | 5 | 1 | 2 | null |
| 2 | 7 | 1 | 3 | null |
| 3 | 9 | 1 | 1 | 100 |
+--------------------+-----------------+------+------+------+
> DROP KEYSPACE ks;
OK