HBASE-1355 [performance] Cache family maxversions; we were calculating on each access
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@769577 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4ffb3cc723
commit
0ce8963a4d
|
@ -90,6 +90,8 @@ Release 0.20.0 - Unreleased
|
||||||
HBASE-1287 Partitioner class not used in TableMapReduceUtil.initTableReduceJob()
|
HBASE-1287 Partitioner class not used in TableMapReduceUtil.initTableReduceJob()
|
||||||
(Lars George and Billy Pearson via Stack)
|
(Lars George and Billy Pearson via Stack)
|
||||||
HBASE-1320 hbase-1234 broke filter tests
|
HBASE-1320 hbase-1234 broke filter tests
|
||||||
|
HBASE-1355 [performance] Cache family maxversions; we were calculating on
|
||||||
|
each access
|
||||||
|
|
||||||
IMPROVEMENTS
|
IMPROVEMENTS
|
||||||
HBASE-1089 Add count of regions on filesystem to master UI; add percentage
|
HBASE-1089 Add count of regions on filesystem to master UI; add percentage
|
||||||
|
|
|
@ -145,6 +145,11 @@ public class HColumnDescriptor implements ISerializable, WritableComparable<HCol
|
||||||
protected Map<ImmutableBytesWritable,ImmutableBytesWritable> values =
|
protected Map<ImmutableBytesWritable,ImmutableBytesWritable> values =
|
||||||
new HashMap<ImmutableBytesWritable,ImmutableBytesWritable>();
|
new HashMap<ImmutableBytesWritable,ImmutableBytesWritable>();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Cache the max versions rather than calculate it every time.
|
||||||
|
*/
|
||||||
|
private int cachedMaxVersions = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor. Must be present for Writable.
|
* Default constructor. Must be present for Writable.
|
||||||
*/
|
*/
|
||||||
|
@ -370,11 +375,13 @@ public class HColumnDescriptor implements ISerializable, WritableComparable<HCol
|
||||||
|
|
||||||
/** @return maximum number of versions */
|
/** @return maximum number of versions */
|
||||||
@TOJSON
|
@TOJSON
|
||||||
public int getMaxVersions() {
|
public synchronized int getMaxVersions() {
|
||||||
String value = getValue(HConstants.VERSIONS);
|
if (this.cachedMaxVersions == -1) {
|
||||||
if (value != null)
|
String value = getValue(HConstants.VERSIONS);
|
||||||
return Integer.valueOf(value).intValue();
|
this.cachedMaxVersions = (value != null)?
|
||||||
return DEFAULT_VERSIONS;
|
Integer.valueOf(value).intValue(): DEFAULT_VERSIONS;
|
||||||
|
}
|
||||||
|
return this.cachedMaxVersions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -632,11 +632,13 @@ public class HBaseRPC {
|
||||||
Object value = method.invoke(instance, call.getParameters());
|
Object value = method.invoke(instance, call.getParameters());
|
||||||
int processingTime = (int) (System.currentTimeMillis() - startTime);
|
int processingTime = (int) (System.currentTimeMillis() - startTime);
|
||||||
int qTime = (int) (startTime-receivedTime);
|
int qTime = (int) (startTime-receivedTime);
|
||||||
LOG.debug("Served: " + call.getMethodName() +
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("Served: " + call.getMethodName() +
|
||||||
" queueTime= " + qTime +
|
" queueTime= " + qTime +
|
||||||
" procesingTime= " + processingTime);
|
" procesingTime= " + processingTime);
|
||||||
rpcMetrics.rpcQueueTime.inc(qTime);
|
rpcMetrics.rpcQueueTime.inc(qTime);
|
||||||
rpcMetrics.rpcProcessingTime.inc(processingTime);
|
rpcMetrics.rpcProcessingTime.inc(processingTime);
|
||||||
|
}
|
||||||
|
|
||||||
MetricsTimeVaryingRate m = rpcMetrics.metricsList.get(call.getMethodName());
|
MetricsTimeVaryingRate m = rpcMetrics.metricsList.get(call.getMethodName());
|
||||||
|
|
||||||
|
|
|
@ -1139,9 +1139,9 @@ public class Store implements HConstants {
|
||||||
throw new IllegalArgumentException("Number of versions must be > 0");
|
throw new IllegalArgumentException("Number of versions must be > 0");
|
||||||
}
|
}
|
||||||
// Make sure we do not return more than maximum versions for this store.
|
// Make sure we do not return more than maximum versions for this store.
|
||||||
return wantedVersions > this.family.getMaxVersions() &&
|
int maxVersions = this.family.getMaxVersions();
|
||||||
wantedVersions != HConstants.ALL_VERSIONS?
|
return wantedVersions > maxVersions &&
|
||||||
this.family.getMaxVersions(): wantedVersions;
|
wantedVersions != HConstants.ALL_VERSIONS? maxVersions: wantedVersions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue