From 8f41f8593f3a83eb942c7bf0fefb95e2fd368d72 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Sun, 14 Jun 2009 03:17:19 +0000 Subject: [PATCH] HBASE-1518 Delete Trackers using compareRow, should just use raw binary comparator git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@784503 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 ++ .../hadoop/hbase/regionserver/GetDeleteTracker.java | 8 ++------ .../apache/hadoop/hbase/regionserver/QueryMatcher.java | 2 +- .../hadoop/hbase/regionserver/ScanDeleteTracker.java | 5 +++-- .../hadoop/hbase/regionserver/TestGetDeleteTracker.java | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 53b887f7285..3f5dc58b162 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -169,6 +169,8 @@ Release 0.20.0 - Unreleased HBASE-1491 ZooKeeper errors: "Client has seen zxid 0xe our last zxid is 0xd" HBASE-1499 Fix javadoc warnings after HBASE-1304 commit (Lars George via Stack) HBASE-1504 Remove left-over debug from 1304 commit + HBASE-1518 Delete Trackers using compareRow, should just use raw + binary comparator (Jon Gray via Stack) IMPROVEMENTS HBASE-1089 Add count of regions on filesystem to master UI; add percentage diff --git a/src/java/org/apache/hadoop/hbase/regionserver/GetDeleteTracker.java b/src/java/org/apache/hadoop/hbase/regionserver/GetDeleteTracker.java index 89f8dde8cda..5f063dc023b 100644 --- a/src/java/org/apache/hadoop/hbase/regionserver/GetDeleteTracker.java +++ b/src/java/org/apache/hadoop/hbase/regionserver/GetDeleteTracker.java @@ -45,15 +45,11 @@ public class GetDeleteTracker implements DeleteTracker { private Iterator iterator; private Delete delete = null; - private KeyValue.KeyComparator comparator; - /** * Constructor * @param comparator */ - public GetDeleteTracker(KeyValue.KeyComparator comparator) { - this.comparator = comparator; - } + public GetDeleteTracker() {} /** * Add the specified KeyValue to the list of deletes to check against for @@ -105,7 +101,7 @@ public class GetDeleteTracker implements DeleteTracker { } // Check column - int ret = comparator.compareRows(buffer, qualifierOffset, qualifierLength, + int ret = Bytes.compareTo(buffer, qualifierOffset, qualifierLength, this.delete.buffer, this.delete.qualifierOffset, this.delete.qualifierLength); if(ret <= -1) { diff --git a/src/java/org/apache/hadoop/hbase/regionserver/QueryMatcher.java b/src/java/org/apache/hadoop/hbase/regionserver/QueryMatcher.java index 823f16ad9d2..0c602e93602 100644 --- a/src/java/org/apache/hadoop/hbase/regionserver/QueryMatcher.java +++ b/src/java/org/apache/hadoop/hbase/regionserver/QueryMatcher.java @@ -130,7 +130,7 @@ public class QueryMatcher { this.tr = get.getTimeRange(); this.oldestStamp = System.currentTimeMillis() - ttl; this.rowComparator = rowComparator; - this.deletes = new GetDeleteTracker(rowComparator); + this.deletes = new GetDeleteTracker(); this.startKey = KeyValue.createFirstOnRow(row); // Single branch to deal with two types of Gets (columns vs all in family) if(columns == null || columns.size() == 0) { diff --git a/src/java/org/apache/hadoop/hbase/regionserver/ScanDeleteTracker.java b/src/java/org/apache/hadoop/hbase/regionserver/ScanDeleteTracker.java index 55e1b4e23fc..a11de8a37be 100644 --- a/src/java/org/apache/hadoop/hbase/regionserver/ScanDeleteTracker.java +++ b/src/java/org/apache/hadoop/hbase/regionserver/ScanDeleteTracker.java @@ -21,6 +21,7 @@ package org.apache.hadoop.hbase.regionserver; import org.apache.hadoop.hbase.KeyValue; +import org.apache.hadoop.hbase.util.Bytes; /** * This class is responsible for the tracking and enforcement of Deletes @@ -78,7 +79,7 @@ public class ScanDeleteTracker implements DeleteTracker { if(deleteBuffer != null && type < deleteType) { // same column, so ignore less specific delete - if(comparator.compareRows(deleteBuffer, deleteOffset, deleteLength, + if(Bytes.compareTo(deleteBuffer, deleteOffset, deleteLength, buffer, qualifierOffset, qualifierLength) == 0){ return; } @@ -112,7 +113,7 @@ public class ScanDeleteTracker implements DeleteTracker { if(deleteBuffer != null) { // TODO ryan use a specific comparator - int ret = comparator.compareRows(deleteBuffer, deleteOffset, deleteLength, + int ret = Bytes.compareTo(deleteBuffer, deleteOffset, deleteLength, buffer, qualifierOffset, qualifierLength); if(ret == 0) { diff --git a/src/test/org/apache/hadoop/hbase/regionserver/TestGetDeleteTracker.java b/src/test/org/apache/hadoop/hbase/regionserver/TestGetDeleteTracker.java index 5314fa4b7b9..c54cae263a4 100644 --- a/src/test/org/apache/hadoop/hbase/regionserver/TestGetDeleteTracker.java +++ b/src/test/org/apache/hadoop/hbase/regionserver/TestGetDeleteTracker.java @@ -68,7 +68,7 @@ public class TestGetDeleteTracker extends HBaseTestCase implements HConstants { private byte delFam = KeyValue.Type.DeleteFamily.getCode(); protected void setUp() throws Exception { - dt = new GetDeleteTracker(KeyValue.KEY_COMPARATOR); + dt = new GetDeleteTracker(); col1 = "col".getBytes(); col2 = "col2".getBytes(); col1Len = col1.length;