HBASE-1682 IndexedRegion does not properly handle deletes
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@831473 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b80f8587bf
commit
d493073e54
|
@ -84,6 +84,8 @@ Release 0.21.0 - Unreleased
|
|||
HBASE-1927 Scanners not closed properly in certain circumstances
|
||||
HBASE-1934 NullPointerException in ClientScanner (Andrew Purtell via Stack)
|
||||
HBASE-1946 Unhandled exception at regionserver (Dmitriy Lyfar via Stack)
|
||||
HBASE-1682 IndexedRegion does not properly handle deletes
|
||||
(Andrew McCall via Clint Morgan and Stack)
|
||||
|
||||
IMPROVEMENTS
|
||||
HBASE-1760 Cleanup TODOs in HTable
|
||||
|
|
|
@ -229,7 +229,7 @@ class IndexedRegion extends TransactionalRegion {
|
|||
@Override
|
||||
public void delete(Delete delete, final Integer lockid, boolean writeToWAL)
|
||||
throws IOException {
|
||||
|
||||
// First remove the existing indexes.
|
||||
if (!getIndexes().isEmpty()) {
|
||||
// Need all columns
|
||||
NavigableSet<byte[]> neededColumns = getColumnsForIndexes(getIndexes());
|
||||
|
@ -251,13 +251,17 @@ class IndexedRegion extends TransactionalRegion {
|
|||
for (IndexSpecification indexSpec : getIndexes()) {
|
||||
removeOldIndexEntry(indexSpec, delete.getRow(), oldColumnValues);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle if there is still a version visible.
|
||||
if (delete.getTimeStamp() != HConstants.LATEST_TIMESTAMP) {
|
||||
get.setTimeRange(1, delete.getTimeStamp());
|
||||
oldRow = super.get(get, lockid);
|
||||
SortedMap<byte[], byte[]> currentColumnValues = convertToValueMap(oldRow);
|
||||
super.delete(delete, lockid, writeToWAL);
|
||||
|
||||
if (!getIndexes().isEmpty()) {
|
||||
Get get = new Get(delete.getRow());
|
||||
|
||||
// Rebuild index if there is still a version visible.
|
||||
Result currentRow = super.get(get, lockid);
|
||||
if (!currentRow.isEmpty()) {
|
||||
SortedMap<byte[], byte[]> currentColumnValues = convertToValueMap(currentRow);
|
||||
for (IndexSpecification indexSpec : getIndexes()) {
|
||||
if (IndexMaintenanceUtils.doesApplyToIndex(indexSpec, currentColumnValues)) {
|
||||
updateIndex(indexSpec, delete.getRow(), currentColumnValues);
|
||||
|
@ -265,7 +269,7 @@ class IndexedRegion extends TransactionalRegion {
|
|||
}
|
||||
}
|
||||
}
|
||||
super.delete(delete, lockid, writeToWAL);
|
||||
|
||||
}
|
||||
|
||||
private SortedMap<byte[], byte[]> convertToValueMap(Result result) {
|
||||
|
|
Loading…
Reference in New Issue