mirror of https://github.com/apache/cassandra
make GC_GRACE_IN_SECONDS customizable in storage.conf.
patch by jbellis; reviewed by Eric Evans for #33 git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@766134 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
560dc2a10f
commit
fa1f80f40d
|
|
@ -45,6 +45,12 @@
|
|||
<BootstrapFileDirectory>/var/cassandra/bootstrap</BootstrapFileDirectory>
|
||||
<StagingFileDirectory>/var/cassandra/staging</StagingFileDirectory>
|
||||
<CommitLogFastSync>false</CommitLogFastSync>
|
||||
<!-- Time to wait before garbage-collection deletion markers.
|
||||
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. -->
|
||||
<GCGraceSeconds>864000</GCGraceSeconds>
|
||||
<Tables>
|
||||
<Table Name = "Table1">
|
||||
<ColumnFamily ColumnSort="Name" Name="Standard1"/>
|
||||
|
|
|
|||
|
|
@ -27,14 +27,11 @@ import org.apache.log4j.Logger;
|
|||
import org.apache.cassandra.db.ColumnFamily;
|
||||
import org.apache.cassandra.db.Table;
|
||||
import org.apache.cassandra.db.TypeInfo;
|
||||
import org.apache.cassandra.db.DBManager;
|
||||
import org.apache.cassandra.db.SystemTable;
|
||||
import org.apache.cassandra.db.Table.TableMetadata;
|
||||
import org.apache.cassandra.utils.FileUtils;
|
||||
import org.apache.cassandra.utils.XMLUtils;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.apache.cassandra.io.*;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -116,10 +113,12 @@ public class DatabaseDescriptor
|
|||
private static String jobTrackerHost_;
|
||||
/* Zookeeper session timeout. */
|
||||
private static int zkSessionTimeout_ = 30000;
|
||||
|
||||
/* time to wait before garbage collecting tombstones (deletion markers) */
|
||||
private static int gcGraceInSeconds_ = 10 * 24 * 3600; // 10 days
|
||||
|
||||
// the path qualified config file (storage-conf.xml) name
|
||||
private static String configFileName_;
|
||||
|
||||
|
||||
static
|
||||
{
|
||||
try
|
||||
|
|
@ -148,6 +147,10 @@ public class DatabaseDescriptor
|
|||
/* Job Jar file location */
|
||||
jobJarFileLocation_ = xmlUtils.getNodeValue("/Storage/JobJarFileLocation");
|
||||
|
||||
String gcGrace = xmlUtils.getNodeValue("/Storage/GCGraceSeconds");
|
||||
if ( gcGrace != null )
|
||||
gcGraceInSeconds_ = Integer.parseInt(gcGrace);
|
||||
|
||||
/* Zookeeper's session timeout */
|
||||
String zkSessionTimeout = xmlUtils.getNodeValue("/Storage/ZookeeperSessionTimeout");
|
||||
if ( zkSessionTimeout != null )
|
||||
|
|
@ -462,6 +465,11 @@ public class DatabaseDescriptor
|
|||
}
|
||||
}
|
||||
|
||||
public static int getGcGraceInSeconds()
|
||||
{
|
||||
return gcGraceInSeconds_;
|
||||
}
|
||||
|
||||
public static String getHashingStrategy()
|
||||
{
|
||||
return hashingStrategy_;
|
||||
|
|
|
|||
|
|
@ -616,8 +616,6 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
return removeDeleted(cf);
|
||||
}
|
||||
|
||||
static final int GC_GRACE_IN_SECONDS = 10 * 24 * 3600; // 10 days
|
||||
|
||||
/*
|
||||
This is complicated because we need to preserve deleted columns, supercolumns, and columnfamilies
|
||||
until they have been deleted for at least GC_GRACE_IN_SECONDS. But, we do not need to preserve
|
||||
|
|
@ -626,7 +624,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
|
|||
*/
|
||||
static ColumnFamily removeDeleted(ColumnFamily cf)
|
||||
{
|
||||
return removeDeleted(cf, (int)(System.currentTimeMillis() / 1000) - GC_GRACE_IN_SECONDS);
|
||||
return removeDeleted(cf, (int)(System.currentTimeMillis() / 1000) - DatabaseDescriptor.getGcGraceInSeconds());
|
||||
}
|
||||
|
||||
static ColumnFamily removeDeleted(ColumnFamily cf, int gcBefore)
|
||||
|
|
|
|||
Loading…
Reference in New Issue