I am a bit confused here in terms of terminology for light weight transactions. I am not sure why in most of the cassandra literature it says that it works only for a single partition.
Like when I use IF NOT EXISTS, IF EXISTS, it should apply to the whole primary key not just partition key as it says in this post as well How the LWT- Light Weight Transaction is working when we use IF NOT EXIST?
However, in the book Cassandra, the Definition Guide, I see this example
INSERT INTO reservation.reservations_by_confirmation
(confirm_number,
hotel_id, start_date, end_date, room_number, guest_id) VALUES (
'RS2G0Z', 'NY456', '2020-06-08', '2020-06-10', 111, 1b4d86f4-ccff-
4256-a63d-45c905df2677) IF NOT EXISTS;
This command checks to see if there is a record with the partition key, which for this table consists of the confirm_number. So let’s find out what happens when you execute this command a second time:
INSERT INTO reservation.reservations_by_confirmation
(confirm_number,
hotel_id, start_date, end_date, room_number, guest_id) VALUES (
'RS2G0Z', 'NY456', '2020-06-08', '2020-06-10', 111, 1b4d86f4-ccff-
4256-a63d-45c905df2677) IF NOT EXISTS;
In this case, the transaction fails, because there is already a reservation with the number “RS2G0Z,” and cqlsh helpfully echoes back a row containing a failure indication and the values you tried to enter.
Now my question is if I run, another query
INSERT INTO reservation.reservations_by_confirmation
(confirm_number,
hotel_id, start_date, end_date, room_number, guest_id) VALUES (
'RS2G0Z', 'NY466', '2020-06-08', '2020-06-10', 111, 1b4d86f4-ccff-
4256-a63d-45c905df2677) IF NOT EXISTS;
which is a different primary key but with the same partition key, it should succeed
So when the book says
This command checks to see if there is a record with the partition key
Isn't this a wrong statement? Please let me know if I am misinterpreting something