HBASE-929 clarify that ttl in HColumnDescriptor is seconds

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@704967 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2008-10-15 17:35:18 +00:00
parent db217e6a15
commit 5b2e15021c
3 changed files with 10 additions and 8 deletions

View File

@ -26,6 +26,7 @@ Release 0.19.0 - Unreleased
HBASE-925 HRS NPE on way out if no master to connect to HBASE-925 HRS NPE on way out if no master to connect to
HBASE-928 NPE throwing RetriesExhaustedException HBASE-928 NPE throwing RetriesExhaustedException
HBASE-924 Update hadoop in lib on 0.18 hbase branch to 0.18.1 HBASE-924 Update hadoop in lib on 0.18 hbase branch to 0.18.1
HBASE-929 Clarify that ttl in HColumnDescriptor is seconds
IMPROVEMENTS IMPROVEMENTS
HBASE-901 Add a limit to key length, check key and value length on client side HBASE-901 Add a limit to key length, check key and value length on client side

View File

@ -177,7 +177,7 @@ public class HColumnDescriptor implements WritableComparable {
* cache * cache
* @param blockCacheEnabled If true, MapFile blocks should be cached * @param blockCacheEnabled If true, MapFile blocks should be cached
* @param maxValueLength Restrict values to <= this value * @param maxValueLength Restrict values to <= this value
* @param timeToLive Time-to-live of cell contents, in seconds from last timestamp * @param timeToLive Time-to-live of cell contents, in seconds
* (use HConstants.FOREVER for unlimited TTL) * (use HConstants.FOREVER for unlimited TTL)
* @param bloomFilter Enable the specified bloom filter for this column * @param bloomFilter Enable the specified bloom filter for this column
* *
@ -389,17 +389,15 @@ public class HColumnDescriptor implements WritableComparable {
} }
/** /**
* @return Time to live. * @return Time-to-live of cell contents, in seconds.
*/ */
public int getTimeToLive() { public int getTimeToLive() {
String value = getValue(TTL); String value = getValue(TTL);
if (value != null) return (value != null)? Integer.valueOf(value).intValue(): DEFAULT_TTL;
return Integer.valueOf(value);
return DEFAULT_TTL;
} }
/** /**
* @param timeToLive * @param timeToLive Time-to-live of cell contents, in seconds.
*/ */
public void setTimeToLive(int timeToLive) { public void setTimeToLive(int timeToLive) {
setValue(TTL, Integer.toString(timeToLive)); setValue(TTL, Integer.toString(timeToLive));
@ -411,7 +409,7 @@ public class HColumnDescriptor implements WritableComparable {
public boolean isBlockCacheEnabled() { public boolean isBlockCacheEnabled() {
String value = getValue(BLOCKCACHE); String value = getValue(BLOCKCACHE);
if (value != null) if (value != null)
return Boolean.valueOf(value); return Boolean.valueOf(value).booleanValue();
return DEFAULT_BLOCKCACHE; return DEFAULT_BLOCKCACHE;
} }

View File

@ -85,6 +85,7 @@ public class HStore implements HConstants {
private final SequenceFile.CompressionType compression; private final SequenceFile.CompressionType compression;
final FileSystem fs; final FileSystem fs;
private final HBaseConfiguration conf; private final HBaseConfiguration conf;
// ttl in milliseconds.
protected long ttl; protected long ttl;
private long majorCompactionTime; private long majorCompactionTime;
private int maxFilesToCompact; private int maxFilesToCompact;
@ -166,9 +167,11 @@ public class HStore implements HConstants {
this.family = family; this.family = family;
this.fs = fs; this.fs = fs;
this.conf = conf; this.conf = conf;
// getTimeToLive returns ttl in seconds. Convert to milliseconds.
this.ttl = family.getTimeToLive(); this.ttl = family.getTimeToLive();
if (ttl != HConstants.FOREVER) if (ttl != HConstants.FOREVER) {
this.ttl *= 1000; this.ttl *= 1000;
}
this.memcache = new Memcache(this.ttl, info); this.memcache = new Memcache(this.ttl, info);
this.compactionDir = HRegion.getCompactionDir(basedir); this.compactionDir = HRegion.getCompactionDir(basedir);
this.storeName = Bytes.toBytes(this.info.getEncodedName() + "/" + this.storeName = Bytes.toBytes(this.info.getEncodedName() + "/" +