Files
scylladb/test/cql/token_from_null_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

28 lines
1.1 KiB
Plaintext

> -- single null value
> CREATE KEYSPACE reproducer WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 1};
OK
> CREATE TABLE reproducer.t(pk int PRIMARY KEY, v int);
OK
> INSERT INTO reproducer.t (pk) VALUES (1);
OK
> SELECT TOKEN(v) FROM reproducer.t;
+-------------------+
| system.token(v) |
|-------------------|
| null |
+-------------------+
>
> -- multiple null values
> CREATE TABLE reproducer.t2(pk int PRIMARY KEY, a int, b int);
OK
> INSERT INTO reproducer.t2 (pk) VALUES (1);
OK
> SELECT TOKEN(pk, a, b) FROM reproducer.t2;
Error from server: code=2200 [Invalid query] message="Invalid number of arguments in call to function system.token: 1 required but 3 provided"
> SELECT TOKEN(pk, b) FROM reproducer.t2;
Error from server: code=2200 [Invalid query] message="Invalid number of arguments in call to function system.token: 1 required but 2 provided"
> SELECT TOKEN(a, b) FROM reproducer.t2;
Error from server: code=2200 [Invalid query] message="Invalid number of arguments in call to function system.token: 1 required but 2 provided"
>
> DROP KEYSPACE reproducer;OK