You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "nkeywal (JIRA)" <ji...@apache.org> on 2011/07/20 18:32:58 UTC
[jira] [Commented] (HBASE-4118) method
regionserver.MemStore/updateColumnValue: the check for qualifier and family
is missing in the code
[ https://issues.apache.org/jira/browse/HBASE-4118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13068479#comment-13068479 ]
nkeywal commented on HBASE-4118:
--------------------------------
This patch:
- fix the point mention in the bug
- modify the order of the test before updating the now value to improve the performances
- remove a redundant array creation in the return.
diff --git a/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java b/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java
index 4b5d62f..d75c30e 100644
--- a/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java
+++ b/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java
@@ -458,25 +458,24 @@ public class MemStore implements HeapSize {
KeyValue kv = it.next();
// if this isnt the row we are interested in, then bail:
- if (!firstKv.matchingColumn(family,qualifier) || !firstKv.matchingRow(kv) ) {
+ if (!kv.matchingColumn(family,qualifier) || !firstKv.matchingRow(kv) ) {
break; // rows dont match, bail.
}
// if the qualifier matches and it's a put, just RM it out of the kvset.
- if (firstKv.matchingQualifier(kv)) {
- // to be extra safe we only remove Puts that have a memstoreTS==0
- if (kv.getType() == KeyValue.Type.Put.getCode()) {
- now = Math.max(now, kv.getTimestamp());
+ if (kv.getType() == KeyValue.Type.Put.getCode() &&
+ kv.getTimestamp() > now &&
+ firstKv.matchingQualifier(kv)
+ ) {
+ now = kv.getTimestamp();
}
}
- }
// create or update (upsert) a new KeyValue with
// 'now' and a 0 memstoreTS == immediately visible
- return upsert(Arrays.asList(new KeyValue [] {
- new KeyValue(row, family, qualifier, now,
- Bytes.toBytes(newValue))
- }));
+ return upsert(Arrays.asList(
+ new KeyValue(row, family, qualifier, now, Bytes.toBytes(newValue)))
+ );
} finally {
this.lock.readLock().unlock();
}
> method regionserver.MemStore/updateColumnValue: the check for qualifier and family is missing in the code
> ---------------------------------------------------------------------------------------------------------
>
> Key: HBASE-4118
> URL: https://issues.apache.org/jira/browse/HBASE-4118
> Project: HBase
> Issue Type: Bug
> Components: regionserver
> Affects Versions: 0.90.3
> Environment: all
> Reporter: nkeywal
> Priority: Minor
>
> [...]
> while (it.hasNext()) {
> KeyValue kv = it.next();
> // if this isnt the row we are interested in, then bail:
> if (!firstKv.matchingColumn(family, qualifier) || !firstKv.matchingRow(kv)) {
> break; // rows dont match, bail.
> }
> [...]
> }
> should be replaced by:
> // if this isnt the row we are interested in, then bail:
> if (!kv.matchingColumn(family, qualifier) || !firstKv.matchingRow(kv)) {
> break; // rows dont match, bail.
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira