cassandrascylla

Scylladb error LWT is not yet supported with tablets


i want to implement sequence in Scylladb so i created a table :

CREATE TABLE project.sequence (
 name ascii PRIMARY KEY,
 value bigint
);

Then i inserted a row:

INSERT INTO project.sequence (name,value) VALUES ('UID', 1000);

Now i just want to update sequence where name is 'UID' but i got a LWT error from Scylla.

UPDATE project.sequence SET value=? WHERE name='UID' IF value=?;

This is error :

InvalidRequest: Error from server: code=2200 [Invalid query] message="Cannot use LightWeight Transactions for table project.sequence: LWT is not yet supported with tablets"

In fact, i get this error every where I use LWT (if condition) !!!! What is the problem ?


Solution

  • I'll summarize the comments made by Piotr and Tzach into an organized answer:

    ScyllaDB 6.0 introduces a new replication mechanism, called "tablets", where tables are split into small pieces ("tablets") that can be more easily and efficiently moved between nodes compared to the previous "vnodes" implementation.

    Tablets have a lot of interesting benefits and promise, but as a new feature, it also has some temporary limitations until all the creases are ironed out. These limitations are listed in this page. One of the features not currently supported in conjunction with tablets is LWT, as you noticed.

    The "tablets" feature is per-keyspace, so although it is turned on by default on new keyspaces, you can easily create a keyspace without tablets (i.e., use the classic vnode implementation), and then tables created in this keyspace will not use tablets, and will support LWT as before.

    Note that if you CREATE KEYSPACE with tablets turned on (which is the default on ScyllaDB 6.0), you will get the following warning message:

    Tables in this keyspace will be replicated using tablets, and will not support the CDC feature (issue #16317) and LWT may suffer from issue #5251 more often. If you want to use CDC or LWT, please drop this keyspace and re-create it without tablets, by adding AND TABLETS = {'enabled': false} to the CREATE KEYSPACE statement.");

    This error message is slightly misleading - it's not just that "LWT may suffer" from such issue - at this stage we outright forbid LWT with tablets and those requests will be outright rejected. But the warning message is useful in that it tells you the exact syntax to disable tablets in the CREATE KEYSPACE command.