You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Michael Gottesman (JIRA)" <ji...@apache.org> on 2008/12/27 05:39:44 UTC
[jira] Created: (HBASE-1090) Atomic Check And Save in HTable
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
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 follows:
1. Server gets locks on row.
2. Server checks that the actual values of the specified columns match the given expected values
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.
[jira] Commented: (HBASE-1090) Atomic Check And Save in HTable
Posted by "Michael Gottesman (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HBASE-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12659307#action_12659307 ]
Michael Gottesman commented on HBASE-1090:
------------------------------------------
also, before I forget, I have not had a chance to run the unit test. I am using new computers and for some reason the tests are failing (aka a bunch of tests that I did not touch), and I am pretty sure it is due to problems I have had before (this seems eerily familiar ; p). I can test it in a few days (I am traveling tonight) or if someone else could apply the patch and run the tests, it would be great.
> 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 follows:
> 1. Server gets locks on row.
> 2. Server checks that the actual values of the specified columns match the given expected values
> 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.
[jira] Issue Comment Edited: (HBASE-1090) Atomic Check And Save in
HTable
Posted by "Andrew Purtell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HBASE-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12659913#action_12659913 ]
apurtell edited comment on HBASE-1090 at 12/30/08 11:52 AM:
------------------------------------------------------------------
Stack, I think you are thinking of the atomic increment and decrement stuff that jgray contributed in HBASE-803.
was (Author: apurtell):
I think you are thinking of the atomic increment and decrement stuff that jgray contributed in HBASE-803.
> 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 follows:
> 1. Server gets locks on row.
> 2. Server checks that the actual values of the specified columns match the given expected values
> 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.
[jira] Updated: (HBASE-1090) Atomic Check And Save in HTable
Posted by "Michael Gottesman (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HBASE-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Gottesman updated HBASE-1090:
-------------------------------------
Attachment: hbase-1090v2.patch
version 2
> 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, hbase-1090v2.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 follows:
> 1. Server gets locks on row.
> 2. Server checks that the actual values of the specified columns match the given expected values
> 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.
[jira] Commented: (HBASE-1090) Atomic Check And Save in HTable
Posted by "Andrew Purtell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HBASE-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12659913#action_12659913 ]
Andrew Purtell commented on HBASE-1090:
---------------------------------------
I think you are thinking of the atomic increment and decrement stuff that jgray contributed in HBASE-803.
> 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 follows:
> 1. Server gets locks on row.
> 2. Server checks that the actual values of the specified columns match the given expected values
> 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.
[jira] Updated: (HBASE-1090) Atomic Check And Save in HTable
Posted by "stack (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HBASE-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
stack updated HBASE-1090:
-------------------------
Attachment: 1090v3.patch
Michael, the test fails for me. It seems as though it has to do with your returning a Boolean from checkAndSave. I think if you change it to return the primitive boolean type, it should work. The attached patch applies (v2 doesn't apply since I added your other patch). You might move the testCheckAndSave up in TestHTable so its first and runs first before all others while your debugging to save yourself some time.
Good stuff (otherwise patch looks good to me).
> 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: 1090v3.patch, hbase-1090.patch, hbase-1090v2.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 follows:
> 1. Server gets locks on row.
> 2. Server checks that the actual values of the specified columns match the given expected values
> 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.
[jira] Updated: (HBASE-1090) Atomic Check And Save in HTable
Posted by "Michael Gottesman (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HBASE-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Gottesman updated HBASE-1090:
-------------------------------------
Attachment: hbase-1090.patch
> 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 follows:
> 1. Server gets locks on row.
> 2. Server checks that the actual values of the specified columns match the given expected values
> 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.
[jira] Commented: (HBASE-1090) Atomic Check And Save in HTable
Posted by "stack (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HBASE-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12659946#action_12659946 ]
stack commented on HBASE-1090:
------------------------------
yes
> 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 follows:
> 1. Server gets locks on row.
> 2. Server checks that the actual values of the specified columns match the given expected values
> 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.
[jira] Commented: (HBASE-1090) Atomic Check And Save in HTable
Posted by "Michael Gottesman (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HBASE-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12661084#action_12661084 ]
Michael Gottesman commented on HBASE-1090:
------------------------------------------
So I went through it and found the issue. The problem that seemed to be happening had to do with me returning false in the middle of the checkAndSave in HRegion/releasing locks in the middle of the checkAndSave in HRegion. Instead of doing that, I created a variable that just said whether or not the expected values matched up and then if it doesn't skips the save part of check and save. Then in the typical HBase fashion the locks are released and a value is returned after all of the try blocks have closed.
Attached is the new patch.
> 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: 1090v3.patch, 1090v4.patch, hbase-1090.patch, hbase-1090v2.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 follows:
> 1. Server gets locks on row.
> 2. Server checks that the actual values of the specified columns match the given expected values
> 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.
[jira] Updated: (HBASE-1090) Atomic Check And Save in HTable
Posted by "Michael Gottesman (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HBASE-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Gottesman updated HBASE-1090:
-------------------------------------
Attachment: 1090v5.patch
> 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: 1090v3.patch, 1090v4.patch, 1090v5.patch, hbase-1090.patch, hbase-1090v2.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 follows:
> 1. Server gets locks on row.
> 2. Server checks that the actual values of the specified columns match the given expected values
> 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.
[jira] Commented: (HBASE-1090) Atomic Check And Save in HTable
Posted by "stack (JIRA)" <ji...@apache.org>.
[ 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:
{code}
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail("Should not have any exception " +
+ e.getClass());
+ }
{code}
+ 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 follows:
> 1. Server gets locks on row.
> 2. Server checks that the actual values of the specified columns match the given expected values
> 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.
[jira] Assigned: (HBASE-1090) Atomic Check And Save in HTable
Posted by "stack (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HBASE-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
stack reassigned HBASE-1090:
----------------------------
Assignee: Michael Gottesman
> 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
> Assignee: Michael Gottesman
> Priority: Minor
> Fix For: 0.19.0
>
> Attachments: 1090v3.patch, 1090v4.patch, 1090v5.patch, hbase-1090.patch, hbase-1090v2.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 follows:
> 1. Server gets locks on row.
> 2. Server checks that the actual values of the specified columns match the given expected values
> 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.
[jira] Updated: (HBASE-1090) Atomic Check And Save in HTable
Posted by "stack (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HBASE-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
stack updated HBASE-1090:
-------------------------
Attachment: 1090v4.patch
Michael, this patch changes the Boolean returns to boolean. It gets further but still not right. The assertions at end of your test keep coming back true regardless.
> 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: 1090v3.patch, 1090v4.patch, hbase-1090.patch, hbase-1090v2.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 follows:
> 1. Server gets locks on row.
> 2. Server checks that the actual values of the specified columns match the given expected values
> 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.
[jira] Resolved: (HBASE-1090) Atomic Check And Save in HTable
Posted by "stack (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HBASE-1090?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
stack resolved HBASE-1090.
--------------------------
Resolution: Fixed
Fix Version/s: 0.19.0
Committed (after removing debug). Thanks for the patch Michael.
> 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
> Fix For: 0.19.0
>
> Attachments: 1090v3.patch, 1090v4.patch, 1090v5.patch, hbase-1090.patch, hbase-1090v2.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 follows:
> 1. Server gets locks on row.
> 2. Server checks that the actual values of the specified columns match the given expected values
> 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.