I am writing data into a Cassandra cluster using Astyanax like so:
private void writeToBatch(Collection<Program> programBatch, MutationBatch batch) {
ColumnFamily<UUID, String> programsCF = keyspaceProvider.getColumnFamily(PROGRAMS_COLUMN_FAMILY);
programBatch.forEach(program -> {
batch.withRow(programsCF, program.getProgramId())
.putColumn(COLUMN_NAME_TITLE, program.getTitle())
.putColumn(COLUMN_NAME_LANGUAGE, program.getLanguage().getShortCode())
.putColumn(COLUMN_NAME_COUNTRY, program.getCountry().getCode())
.putColumn(COLUMN_NAME_START, program.getStart())
.putColumn(COLUMN_NAME_STOP, program.getStop())
.putColumn(COLUMN_NAME_STREAM, program.getStream());
});
}
...
batch.execute();
Table schema:
CREATE TABLE "RS"."Programs" (
key uuid,
column1 text,
value blob,
PRIMARY KEY (key, column1)
) WITH COMPACT STORAGE
AND CLUSTERING ORDER BY (column1 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 = 2592000
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 = 'NONE';
Version: [cqlsh 5.0.1 | Cassandra 3.0.9 | CQL spec 3.4.0 | Native protocol v4]
The table that I write into has a default_time_to_live of 30 days, but the data that is being written in there seems to have TTL null and is never deleted. I was under the assumption that if I don't specify a TTL in the write, the default one of the table will be used?