HBASE-3008 Memstore.updateColumnValue passes wrong flag to heapSizeChange (Causes memstore size to go negative)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1005261 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3745672d94
commit
1e14da3d78
|
@ -568,6 +568,8 @@ Release 0.21.0 - Unreleased
|
||||||
HBASE-3059 TestReadWriteConsistencyControl occasionally hangs (Hairong
|
HBASE-3059 TestReadWriteConsistencyControl occasionally hangs (Hairong
|
||||||
via Ryan)
|
via Ryan)
|
||||||
HBASE-2906 [rest/stargate] URI decoding in RowResource
|
HBASE-2906 [rest/stargate] URI decoding in RowResource
|
||||||
|
HBASE-3008 Memstore.updateColumnValue passes wrong flag to heapSizeChange
|
||||||
|
(Causes memstore size to go negative)
|
||||||
|
|
||||||
IMPROVEMENTS
|
IMPROVEMENTS
|
||||||
HBASE-1760 Cleanup TODOs in HTable
|
HBASE-1760 Cleanup TODOs in HTable
|
||||||
|
|
|
@ -1933,7 +1933,6 @@ public class KeyValue implements Writable, HeapSize {
|
||||||
ClassSize.align(ClassSize.ARRAY) + ClassSize.align(length) +
|
ClassSize.align(ClassSize.ARRAY) + ClassSize.align(length) +
|
||||||
(3 * Bytes.SIZEOF_INT) +
|
(3 * Bytes.SIZEOF_INT) +
|
||||||
ClassSize.align(ClassSize.ARRAY) +
|
ClassSize.align(ClassSize.ARRAY) +
|
||||||
ClassSize.align((rowCache == null ? 0 : rowCache.length)) +
|
|
||||||
(2 * Bytes.SIZEOF_LONG));
|
(2 * Bytes.SIZEOF_LONG));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1958,6 +1958,22 @@ public class TestHRegion extends HBaseTestCase {
|
||||||
assertICV(row, fam1, qual1, value+amount);
|
assertICV(row, fam1, qual1, value+amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testIncrementColumnValue_heapSize() throws IOException {
|
||||||
|
EnvironmentEdgeManagerTestHelper.injectEdge(new IncrementingEnvironmentEdge());
|
||||||
|
|
||||||
|
initHRegion(tableName, getName(), fam1);
|
||||||
|
|
||||||
|
long byAmount = 1L;
|
||||||
|
long size;
|
||||||
|
|
||||||
|
for( int i = 0; i < 1000 ; i++) {
|
||||||
|
region.incrementColumnValue(row, fam1, qual1, byAmount, true);
|
||||||
|
|
||||||
|
size = region.memstoreSize.get();
|
||||||
|
assertTrue("memstore size: " + size, size >= 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void testIncrementColumnValue_UpdatingInPlace_Negative()
|
public void testIncrementColumnValue_UpdatingInPlace_Negative()
|
||||||
throws IOException {
|
throws IOException {
|
||||||
initHRegion(tableName, getName(), fam1);
|
initHRegion(tableName, getName(), fam1);
|
||||||
|
|
|
@ -53,6 +53,7 @@ import org.apache.hadoop.hbase.regionserver.wal.HLog;
|
||||||
import org.apache.hadoop.hbase.util.Bytes;
|
import org.apache.hadoop.hbase.util.Bytes;
|
||||||
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
|
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
|
||||||
import org.apache.hadoop.hbase.util.EnvironmentEdgeManagerTestHelper;
|
import org.apache.hadoop.hbase.util.EnvironmentEdgeManagerTestHelper;
|
||||||
|
import org.apache.hadoop.hbase.util.IncrementingEnvironmentEdge;
|
||||||
import org.apache.hadoop.hbase.util.ManualEnvironmentEdge;
|
import org.apache.hadoop.hbase.util.ManualEnvironmentEdge;
|
||||||
import org.apache.hadoop.security.UnixUserGroupInformation;
|
import org.apache.hadoop.security.UnixUserGroupInformation;
|
||||||
|
|
||||||
|
@ -69,6 +70,7 @@ public class TestStore extends TestCase {
|
||||||
byte [] family = Bytes.toBytes("family");
|
byte [] family = Bytes.toBytes("family");
|
||||||
|
|
||||||
byte [] row = Bytes.toBytes("row");
|
byte [] row = Bytes.toBytes("row");
|
||||||
|
byte [] row2 = Bytes.toBytes("row2");
|
||||||
byte [] qf1 = Bytes.toBytes("qf1");
|
byte [] qf1 = Bytes.toBytes("qf1");
|
||||||
byte [] qf2 = Bytes.toBytes("qf2");
|
byte [] qf2 = Bytes.toBytes("qf2");
|
||||||
byte [] qf3 = Bytes.toBytes("qf3");
|
byte [] qf3 = Bytes.toBytes("qf3");
|
||||||
|
@ -332,6 +334,62 @@ public class TestStore extends TestCase {
|
||||||
assertEquals(oldValue, Bytes.toLong(results.get(1).getValue()));
|
assertEquals(oldValue, Bytes.toLong(results.get(1).getValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testICV_negMemstoreSize() throws IOException {
|
||||||
|
init(this.getName());
|
||||||
|
|
||||||
|
long time = 100;
|
||||||
|
ManualEnvironmentEdge ee = new ManualEnvironmentEdge();
|
||||||
|
ee.setValue(time);
|
||||||
|
EnvironmentEdgeManagerTestHelper.injectEdge(ee);
|
||||||
|
long newValue = 3L;
|
||||||
|
long size = 0;
|
||||||
|
|
||||||
|
|
||||||
|
size += this.store.add(new KeyValue(Bytes.toBytes("200909091000"), family, qf1,
|
||||||
|
System.currentTimeMillis(),
|
||||||
|
Bytes.toBytes(newValue)));
|
||||||
|
size += this.store.add(new KeyValue(Bytes.toBytes("200909091200"), family, qf1,
|
||||||
|
System.currentTimeMillis(),
|
||||||
|
Bytes.toBytes(newValue)));
|
||||||
|
size += this.store.add(new KeyValue(Bytes.toBytes("200909091300"), family, qf1,
|
||||||
|
System.currentTimeMillis(),
|
||||||
|
Bytes.toBytes(newValue)));
|
||||||
|
size += this.store.add(new KeyValue(Bytes.toBytes("200909091400"), family, qf1,
|
||||||
|
System.currentTimeMillis(),
|
||||||
|
Bytes.toBytes(newValue)));
|
||||||
|
size += this.store.add(new KeyValue(Bytes.toBytes("200909091500"), family, qf1,
|
||||||
|
System.currentTimeMillis(),
|
||||||
|
Bytes.toBytes(newValue)));
|
||||||
|
|
||||||
|
|
||||||
|
for ( int i = 0 ; i < 10000 ; ++i) {
|
||||||
|
newValue++;
|
||||||
|
|
||||||
|
long ret = this.store.updateColumnValue(row, family, qf1, newValue);
|
||||||
|
long ret2 = this.store.updateColumnValue(row2, family, qf1, newValue);
|
||||||
|
|
||||||
|
if (ret != 0) System.out.println("ret: " + ret);
|
||||||
|
if (ret2 != 0) System.out.println("ret2: " + ret2);
|
||||||
|
|
||||||
|
assertTrue("ret: " + ret, ret >= 0);
|
||||||
|
size += ret;
|
||||||
|
assertTrue("ret2: " + ret2, ret2 >= 0);
|
||||||
|
size += ret2;
|
||||||
|
|
||||||
|
|
||||||
|
if (i % 1000 == 0)
|
||||||
|
ee.setValue(++time);
|
||||||
|
}
|
||||||
|
|
||||||
|
long computedSize=0;
|
||||||
|
for (KeyValue kv : this.store.memstore.kvset) {
|
||||||
|
long kvsize = this.store.memstore.heapSizeChange(kv, true);
|
||||||
|
//System.out.println(kv + " size= " + kvsize + " kvsize= " + kv.heapSize());
|
||||||
|
computedSize += kvsize;
|
||||||
|
}
|
||||||
|
assertEquals(computedSize, size);
|
||||||
|
}
|
||||||
|
|
||||||
public void testIncrementColumnValue_SnapshotFlushCombo() throws Exception {
|
public void testIncrementColumnValue_SnapshotFlushCombo() throws Exception {
|
||||||
ManualEnvironmentEdge mee = new ManualEnvironmentEdge();
|
ManualEnvironmentEdge mee = new ManualEnvironmentEdge();
|
||||||
EnvironmentEdgeManagerTestHelper.injectEdge(mee);
|
EnvironmentEdgeManagerTestHelper.injectEdge(mee);
|
||||||
|
|
Loading…
Reference in New Issue