You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "stack (JIRA)" <ji...@apache.org> on 2009/06/05 00:49:07 UTC

[jira] Resolved: (HBASE-1483) HLog split loses track of edits

     [ https://issues.apache.org/jira/browse/HBASE-1483?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

stack resolved HBASE-1483.
--------------------------

       Resolution: Fixed
    Fix Version/s: 0.20.0

Committed below to trunk and branch... its a little different to what Clint posted.. please check it.

Thanks for finding this Clint.  Please don't tell anyone that we had such a dumb bug.  For sure they'll think us all losers.

Good stuff.

{code}
Index: src/java/org/apache/hadoop/hbase/regionserver/HLog.java
===================================================================
--- src/java/org/apache/hadoop/hbase/regionserver/HLog.java     (revision 780848)
+++ src/java/org/apache/hadoop/hbase/regionserver/HLog.java     (working copy)
@@ -795,13 +795,15 @@
           // reports a zero length even if the file has been sync'd. Revisit if
           // HADOOP-4751 is committed.
           long length = logfiles[i].getLen();
-          HLogKey key = new HLogKey();
-          KeyValue val = new KeyValue();
           SequenceFile.Reader in = null;
               int count = 0;
           try {
             in = new SequenceFile.Reader(fs, logfiles[i].getPath(), conf);
             try {
+              // Make the key and value new each time; otherwise same instance
+              // is used over and over.
+              HLogKey key = new HLogKey();
+              KeyValue val = new KeyValue();
               while (in.next(key, val)) {
                 byte [] regionName = key.getRegionName();
                 LinkedList<HLogEntry> queue = logEntries.get(regionName);
{code}

> HLog split loses track of edits
> -------------------------------
>
>                 Key: HBASE-1483
>                 URL: https://issues.apache.org/jira/browse/HBASE-1483
>             Project: Hadoop HBase
>          Issue Type: Bug
>            Reporter: Clint Morgan
>             Fix For: 0.20.0
>
>         Attachments: 1483.patch
>
>
> HLog:803
>                   queue.push(new HLogEntry(val, key));
> The same val and key references are used in the iterator, so they keep changing their contents as we .next() through the loop.
> Thus, when we are done, all the HLogEntries in logEntries will have the same HLogEdits and HLogKeys! I don't think this would have ever worked unless there is only one region in the log being split.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.