hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "stack (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HBASE-1090) Atomic Check And Save in HTable
Date Tue, 30 Dec 2008 19:35:44 GMT

    [ https://issues.apache.org/jira/browse/HBASE-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12659904#action_12659904

stack commented on HBASE-1090:

Looks great Michael.

Couple of comments:

+ In hadoop/hbase, lines are 80 characters max.  Get your line-wrapper out.
+ You don't need to do the try/catch in test... just let the exception out.  JUnit will report
exception as test failure.  I'm talking about this:

+    } catch (IOException e) {
+      e.printStackTrace();
+      fail("Should not have any exception " +
+        e.getClass());
+    }


+ Why not have checkAndSave on HRS return a boolean rather than a Boolean?
+ I think this map has to be a Writable Michael: final Map<byte[],byte[]> expectedValues.
 See HBaseMapWritable if you are looking for one.
+ I think the javadoc on HTable checkAndSave will generate warnings because it does not make
mention of the method's parameters (try 'ant javadoc').

Otherwise, it looks great.

I thought we already had an issue asking for this functionality but can't find it.

> Atomic Check And Save in HTable
> -------------------------------
>                 Key: HBASE-1090
>                 URL: https://issues.apache.org/jira/browse/HBASE-1090
>             Project: Hadoop HBase
>          Issue Type: New Feature
>            Reporter: Michael Gottesman
>            Priority: Minor
>         Attachments: hbase-1090.patch
> Check And Save is a simple operation where one gives both a BatchUpdate with updates
and a Map mapping columns to expected values (byte[] -> byte[]). The operation works as
> 1. Server gets locks on row.
> 2. Server checks that the actual values of the specified columns match the given expected
> 3. If False, return False, if True update the row
> 4. Unlock row.
> Pretty simple... but useful.
> Included in the attached patch are the necessary updates for HTable, HRegionServer, RegionServerInterface,
and HRegion. I also added a small unit test to HTable where the test checks that checkAndSave
succeeds when the expected values line up and fail when the values are different.

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

View raw message