Question

I need to set GCGraceSeconds to 0, because I have only one node, but I cannot find where I can set value to this. Is it possible to set from astyanax or is it in some settings file?

Was it helpful?

Solution

In more recent versions of cassandra, you actually set gc_grace_seconds on a per column family basis as part of the schema. From what I can tell, Astyanax currently doesn't support setting that property. There is no corresponding method in the ColumnFamilyDefinition class.

https://github.com/Netflix/astyanax/blob/master/src/main/java/com/netflix/astyanax/ddl/ColumnFamilyDefinition.java

You can use the cassandra-cli tool to set the property on any existing column families if you wish.

Additionally, it doesn't look like it would be too hard to add support to Astyanax. I'm sure they would accept a pull request.

Update

Astyanax (for a while) now supports this setting. See ColumnFamilyDefinition. This can be set in the astyanax column family creation like so:

OperationResult<SchemaChangeResult> opres = keyspace.createColumnFamily(cf, ImmutableMap.<String, Object> builder()
    .put("comparator", "UTF8Type")
    .put("key_validation_class", "UTF8Type")
    .put("gc_grace_seconds", 60*60*24) // gc grace seconds of one day
    .build()
);

OTHER TIPS

That is done in conf/cassandra.yaml (Cassandra configuration file)

Prior version 0.7: conf/storage-conf.xml

Remember: "Set this to a large enough value that you are confident that the deletion marker will be propagated to all replicas by the time this many seconds has elapsed, even in the face of hardware failures. The default value is ten days. "

Default is: '864000' seconds, or 10 days.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top