Reputation: 41
I am trying to update a record in a test keyspace and table. When I upsert a record, one column value change is accepted, while the other doesn't take. (Note: I'm also not able to delete the record, despite no error message)
Observe how middle_initial does not update, while title does... What gives?
//Before
cqlsh:my_keyspace> SELECT * FROM user;
last_name | first_name | middle_initial | title
-----------+------------+----------------+-------
Rodriguez | Mary | Q | null
Rodriquez | Mary | Q | O
Nguyen | Bill | null | Mr.
Nguyen | Wanda | null | Mrs.
//Command
cqlsh:my_keyspace> UPDATE user SET middle_initial = 'F', title = 'U' WHERE last_name = 'Rodriquez' AND first_name = 'Mary';
//After
cqlsh:my_keyspace> SELECT * FROM user;
last_name | first_name | middle_initial | title
-----------+------------+----------------+-------
Rodriguez | Mary | Q | null
Rodriquez | Mary | Q | U
Nguyen | Bill | null | Mr.
Nguyen | Wanda | null | Mrs.
//Additional Info
CREATE KEYSPACE my_keyspace WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true;
CREATE TABLE my_keyspace.user (
last_name text,
first_name text,
middle_initial text,
title text,
PRIMARY KEY (last_name, first_name)
) WITH CLUSTERING ORDER BY (first_name ASC)
AND bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND crc_check_chance = 1.0
AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99PERCENTILE';
Upvotes: 2
Views: 257
Reputation: 2310
This happens generally when your column writetime is in future. You can check writetime of your column
SELECT WRITETIME (middle_initial) FROM my_keyspace.user WHERE last_name = 'Rodriquez' AND first_name = 'Mary';
Upvotes: 0
Reputation: 41
Manish was correct. My timestamp for middle_initial was set to a future date of 1623699999999999
To Delete the record (which was actually my goal) I did:
cqlsh:my_keyspace> DELETE FROM user USING timestamp 1623699999999999 WHERE first_name = 'Mary' AND last_name = 'Rodriquez';
Upvotes: 2