Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DFD7DD43A for ; Tue, 18 Sep 2012 18:40:47 +0000 (UTC) Received: (qmail 52490 invoked by uid 500); 18 Sep 2012 18:40:47 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 52441 invoked by uid 500); 18 Sep 2012 18:40:47 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 52434 invoked by uid 99); 18 Sep 2012 18:40:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Sep 2012 18:40:47 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Sep 2012 18:40:41 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 3BB3823889E2 for ; Tue, 18 Sep 2012 18:39:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1387310 [3/3] - in /hbase/branches/0.89-fb/src: main/java/org/apache/hadoop/hbase/regionserver/ main/java/org/apache/hadoop/hbase/thrift/ main/java/org/apache/hadoop/hbase/thrift/generated/ main/java/org/apache/hadoop/hbase/util/ main/reso... Date: Tue, 18 Sep 2012 18:39:55 -0000 To: commits@hbase.apache.org From: mbautin@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120918183956.3BB3823889E2@eris.apache.org> Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/IOError.java URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/IOError.java?rev=1387310&r1=1387309&r2=1387310&view=diff ============================================================================== --- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/IOError.java (original) +++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/IOError.java Tue Sep 18 18:39:54 2012 @@ -369,6 +369,8 @@ public class IOError extends java.io.IOE private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. + __isset_bit_vector = new BitSet(1); read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/IOError.java.new URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/IOError.java.new?rev=1387310&r1=1387309&r2=1387310&view=diff ============================================================================== --- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/IOError.java.new (original) +++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/IOError.java.new Tue Sep 18 18:39:54 2012 @@ -369,6 +369,8 @@ public class IOError extends java.io.IOE private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. + __isset_bit_vector = new BitSet(1); read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/TRowResult.java URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/TRowResult.java?rev=1387310&r1=1387309&r2=1387310&view=diff ============================================================================== --- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/TRowResult.java (original) +++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/thrift/generated/TRowResult.java Tue Sep 18 18:39:54 2012 @@ -443,7 +443,7 @@ public class TRowResult implements org.a for (int _i9 = 0; _i9 < _map8.size; ++_i9) { ByteBuffer _key10; // required - TCell _val11; // required + TCell _val11; // optional _key10 = iprot.readBinary(); _val11 = new TCell(); _val11.read(iprot); @@ -544,7 +544,7 @@ public class TRowResult implements org.a for (int _i15 = 0; _i15 < _map14.size; ++_i15) { ByteBuffer _key16; // required - TCell _val17; // required + TCell _val17; // optional _key16 = iprot.readBinary(); _val17 = new TCell(); _val17.read(iprot); Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/util/Bytes.java URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/util/Bytes.java?rev=1387310&r1=1387309&r2=1387310&view=diff ============================================================================== --- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/util/Bytes.java (original) +++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/util/Bytes.java Tue Sep 18 18:39:54 2012 @@ -1470,4 +1470,12 @@ public class Bytes { return toString(b, 0, n); } + /** + * @param b a byte buffer + * @return true if the given byte buffer is non-null and non-empty (has remaining bytes) + */ + public static boolean isNonEmpty(ByteBuffer b) { + return b != null && b.remaining() > 0; + } + } Modified: hbase/branches/0.89-fb/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift?rev=1387310&r1=1387309&r2=1387310&view=diff ============================================================================== --- hbase/branches/0.89-fb/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift (original) +++ hbase/branches/0.89-fb/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift Tue Sep 18 18:39:54 2012 @@ -172,7 +172,7 @@ exception AlreadyExists { // of merging changes between various client and server branches. service Hbase { - /** + /** * Atomically increment the column value specified. Returns the next value * post increment. */ @@ -272,7 +272,9 @@ service Hbase { 2:Text row, /** name of column whose value is to be deleted */ - 3:Text column + 3:Text column, + + 4:Text regionName ) throws (1:IOError io) /** @@ -286,7 +288,9 @@ service Hbase { 2:Text row /** Delete attributes */ - 3:map attributes + 3:map attributes, + + 4:Text regionName ) throws (1:IOError io) /** @@ -301,7 +305,9 @@ service Hbase { 2:Text row, /** timestamp */ - 3:i64 timestamp + 3:i64 timestamp, + + 4:Text regionName ) throws (1:IOError io) /** @@ -319,7 +325,9 @@ service Hbase { 3:Text column, /** timestamp */ - 4:i64 timestamp + 4:i64 timestamp, + + 5:Text regionName ) throws (1:IOError io) /** @@ -364,7 +372,9 @@ service Hbase { 2:Text row, /** column name */ - 3:Text column + 3:Text column, + + 4:Text regionName ) throws (1:IOError io) /** @@ -400,7 +410,9 @@ service Hbase { 1:Text tableName, /** row key */ - 2:Text row + 2:Text row, + + 3:Text regionName ) throws (1:IOError io) /** @@ -417,7 +429,9 @@ service Hbase { 2:Text row, /** timestamp */ - 3:i64 timestamp + 3:i64 timestamp, + + 4:Text regionName ) throws (1:IOError io) /** @@ -440,7 +454,9 @@ service Hbase { * If only provided then all families are * searched */ - 3:Text prefix + 3:Text prefix, + + 4:Text regionName ) throws (1:IOError io) /** @@ -465,7 +481,9 @@ service Hbase { */ 3:Text prefix - 4:i64 timestamp + 4:i64 timestamp, + + 5:Text regionName ) throws (1:IOError io) /** @@ -482,7 +500,9 @@ service Hbase { 2:Text row, /** List of columns to return, null for all columns */ - 3:list columns + 3:list columns, + + 4:Text regionName ) throws (1:IOError io) /** @@ -500,7 +520,8 @@ service Hbase { /** List of columns to return, null for all columns */ 3:list columns, - 4:i64 timestamp + 4:i64 timestamp, + 5:Text regionName ) throws (1:IOError io) /** @@ -512,6 +533,7 @@ service Hbase { list getRows( 1:Text tableName, 2:list rows, + 3:Text regionName ) throws (1:IOError io) /** @@ -522,7 +544,8 @@ service Hbase { list getRowsTs( 1:Text tableName, 2:list rows, - 3:i64 timestamp + 3:i64 timestamp, + 4:Text regionName ) throws (1:IOError io) /** @@ -533,7 +556,8 @@ service Hbase { list getRowsWithColumns( 1:Text tableName, 2:list rows, - 3:list families + 3:list families, + 4:Text regionName ) throws (1:IOError io) /** @@ -546,7 +570,8 @@ service Hbase { 1:Text tableName, 2:list rows, 3:list families - 4:i64 timestamp + 4:i64 timestamp, + 5:Text regionName ) throws (1:IOError io) /** @@ -584,7 +609,9 @@ service Hbase { 3:Text column, /** number of versions to retrieve */ - 4:i32 numVersions + 4:i32 numVersions, + + 5:Text regionName ) throws (1:IOError io) /** @@ -608,7 +635,9 @@ service Hbase { 4:i64 timestamp, /** number of versions to retrieve */ - 5:i32 numVersions + 5:i32 numVersions, + + 6:Text regionName ) throws (1:IOError io) /** @@ -623,6 +652,22 @@ service Hbase { throws (1:IOError io) /** + * Apply a batch of puts for the target region. + * It assumes all the BatchMuations are Put operations + * and ignores the isDelete field in Mutation. + */ + void multiPut( + /** name of tableName */ + 1:Text tableName, + + /** list of Put */ + 2:list rowBatches, + + /** name of the region */ + 3:Text regionName + ) throws (1:IOError io, 2:IllegalArgument ia) + + /** * Apply a series of mutations (updates/deletes) to a row in a * single transaction. If an exception is thrown, then the * transaction is aborted. Default current timestamp is used, and @@ -639,7 +684,9 @@ service Hbase { 3:list mutations, /** Put attributes */ - 4:map attributes + 4:map attributes, + + 7:Text regionName ) throws (1:IOError io, 2:IllegalArgument ia) /** @@ -662,7 +709,9 @@ service Hbase { 4:i64 timestamp, /** Put attributes */ - 5:map attributes + 5:map attributes, + + 6:Text regionName ) throws (1:IOError io, 2:IllegalArgument ia) /** @@ -679,7 +728,9 @@ service Hbase { 2:list rowBatches, /** Put attributes */ - 3:map attributes + 3:map attributes, + + 4:Text regionName ) throws (1:IOError io, 2:IllegalArgument ia) /** @@ -718,7 +769,9 @@ service Hbase { 3:i64 timestamp, /** Put attributes */ - 4:map attributes + 4:map attributes, + + 5:Text regionName ) throws (1:IOError io, 2:IllegalArgument ia) /** Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/TestMutationWriteToWAL.java URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/TestMutationWriteToWAL.java?rev=1387310&r1=1387309&r2=1387310&view=diff ============================================================================== --- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/TestMutationWriteToWAL.java (original) +++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/TestMutationWriteToWAL.java Tue Sep 18 18:39:54 2012 @@ -110,12 +110,12 @@ public class TestMutationWriteToWAL exte final ByteBuffer rowBuf = ByteBuffer.wrap(Bytes.toBytes(row)); // Exercise both APIs. if (i % 2 == 0) { - client.mutateRow(HTestConst.DEFAULT_TABLE_BYTE_BUF, rowBuf, mutations, null); + client.mutateRow(HTestConst.DEFAULT_TABLE_BYTE_BUF, rowBuf, mutations, null, null); } else { List rowBatches = new ArrayList(); BatchMutation bm = new BatchMutation(rowBuf, mutations); rowBatches.add(bm); - client.mutateRows(HTestConst.DEFAULT_TABLE_BYTE_BUF, rowBatches, null); + client.mutateRows(HTestConst.DEFAULT_TABLE_BYTE_BUF, rowBatches, null, null); } } client.disableTable(HTestConst.DEFAULT_TABLE_BYTE_BUF); @@ -125,7 +125,7 @@ public class TestMutationWriteToWAL exte for (int i = 0; i < NUM_ROWS; ++i) { final String row = getRow(i); List results = client.getRow(HTestConst.DEFAULT_TABLE_BYTE_BUF, - ByteBuffer.wrap(Bytes.toBytes(row))); + ByteBuffer.wrap(Bytes.toBytes(row)), null); TRowResult result = results.get(0); assertEquals("No results found for row " + row, expectedEntriesForRow[i], result.getColumnsSize()); Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftMutationAPI.java URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftMutationAPI.java?rev=1387310&r1=1387309&r2=1387310&view=diff ============================================================================== --- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftMutationAPI.java (original) +++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftMutationAPI.java Tue Sep 18 18:39:54 2012 @@ -134,7 +134,7 @@ public class TestThriftMutationAPI exten if (bms.size() == 1) { doSingleRowMutation(client, rand, bms, defaultTS); } else { - client.mutateRowsTs(HTestConst.DEFAULT_TABLE_BYTE_BUF, bms, defaultTS, null); + client.mutateRowsTs(HTestConst.DEFAULT_TABLE_BYTE_BUF, bms, defaultTS, null, null); numMutateRows++; } @@ -165,7 +165,7 @@ public class TestThriftMutationAPI exten ByteBuffer colBuf = ByteBuffer.wrap(Bytes.toBytes(col)); TRowResult rowResult = rowResults.get(row); if (rowResult == null) { - List result = client.getRow(HTestConst.DEFAULT_TABLE_BYTE_BUF, rowBuf); + List result = client.getRow(HTestConst.DEFAULT_TABLE_BYTE_BUF, rowBuf, null); if (!result.isEmpty()) { assertEquals(1, result.size()); rowResult = result.get(0); @@ -221,7 +221,7 @@ public class TestThriftMutationAPI exten // We did not check-and-mutate, do a normal operation. client.mutateRowTs(HTestConst.DEFAULT_TABLE_BYTE_BUF, - bm.bufferForRow(), bm.getMutations(), defaultTS, null); + bm.bufferForRow(), bm.getMutations(), defaultTS, null, null); numMutateRow++; } Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java?rev=1387310&r1=1387309&r2=1387310&view=diff ============================================================================== --- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java (original) +++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java Tue Sep 18 18:39:54 2012 @@ -263,70 +263,73 @@ public class TestThriftServer { handler.createTable(tableAname, getColumnDescriptors()); try { // Apply a few Mutations to rowA - handler.mutateRow(tableAname, rowAname, getMutations(), null); + handler.mutateRow(tableAname, rowAname, getMutations(), null, null); // Assert that the changes were made assertBufferEquals(valueAname, - handler.get(tableAname, rowAname, columnAname).get(0).value); - TRowResult rowResult1 = handler.getRow(tableAname, rowAname).get(0); + handler.get(tableAname, rowAname, columnAname, null).get(0).value); + TRowResult rowResult1 = handler.getRow(tableAname, rowAname, null).get(0); assertBufferEquals(rowAname, rowResult1.row); assertBufferEquals(valueBname, rowResult1.columns.get(columnBname).value); // Apply a few BatchMutations for rowA and rowB - handler.mutateRows(tableAname, getBatchMutations(), null); + handler.mutateRows(tableAname, getBatchMutations(), null, null); // Assert that changes were made to rowA - List cells = handler.get(tableAname, rowAname, columnAname); + List cells = handler.get(tableAname, rowAname, columnAname, null); assertFalse(cells.size() > 0); - assertBufferEquals(valueCname, handler.get(tableAname, rowAname, columnBname).get(0).value); - List versions = handler.getVer(tableAname, rowAname, columnBname, MAXVERSIONS); + assertBufferEquals(valueCname, handler.get(tableAname, rowAname, columnBname, + null).get(0).value); + List versions = handler.getVer(tableAname, rowAname, columnBname, MAXVERSIONS, + null); assertBufferEquals(valueCname, versions.get(0).value); assertBufferEquals(valueBname, versions.get(1).value); // Assert that changes were made to rowB - TRowResult rowResult2 = handler.getRow(tableAname, rowBname).get(0); + TRowResult rowResult2 = handler.getRow(tableAname, rowBname, + null).get(0); assertBufferEquals(rowBname, rowResult2.row); assertBufferEquals(valueCname, rowResult2.columns.get(columnAname).value); assertBufferEquals(valueDname, rowResult2.columns.get(columnBname).value); // Apply some deletes - handler.deleteAll(tableAname, rowAname, columnBname); - handler.deleteAllRow(tableAname, rowBname, null); + handler.deleteAll(tableAname, rowAname, columnBname, null); + handler.deleteAllRow(tableAname, rowBname, null, null); // Assert that the deletes were applied - int size = handler.get(tableAname, rowAname, columnBname).size(); + int size = handler.get(tableAname, rowAname, columnBname, null).size(); assertEquals(0, size); - size = handler.getRow(tableAname, rowBname).size(); + size = handler.getRow(tableAname, rowBname, null).size(); assertEquals(0, size); // Try null mutation List mutations = new ArrayList(); mutations.add(new Mutation(false, columnAname, null, true, HConstants.LATEST_TIMESTAMP)); - handler.mutateRow(tableAname, rowAname, mutations, null); - TRowResult rowResult3 = handler.getRow(tableAname, rowAname).get(0); + handler.mutateRow(tableAname, rowAname, mutations, null, null); + TRowResult rowResult3 = handler.getRow(tableAname, rowAname, null).get(0); assertEquals(rowAname, rowResult3.row); assertEquals(0, rowResult3.columns.get(columnAname).value.remaining()); // Try specifying timestamps with mutations mutations.clear(); - handler.deleteAllRow(tableAname, rowAname, null); - assertEquals(0, handler.getRow(tableAname, rowAname).size()); + handler.deleteAllRow(tableAname, rowAname, null, null); + assertEquals(0, handler.getRow(tableAname, rowAname, null).size()); // Use a high timestamp to make sure our insertions come later than the above delete-all with // an auto-generated timestamp. // Testing mutateRow. long highTS = HConstants.LATEST_TIMESTAMP / 2; - assertEquals(0, handler.getRow(tableAname, rowAname).size()); + assertEquals(0, handler.getRow(tableAname, rowAname, null).size()); mutations.add(new Mutation(false, columnAname, valueAModified, true, highTS + 257)); mutations.add(new Mutation(false, columnAname, valueAname, true, highTS + 135)); - handler.mutateRow(tableAname, rowAname, mutations, null); - List results = handler.getRow(tableAname, rowAname); + handler.mutateRow(tableAname, rowAname, mutations, null, null); + List results = handler.getRow(tableAname, rowAname, null); assertEquals(1, results.size()); assertBufferEquals(valueAModified, results.get(0).getColumns().get(columnAname).value); - handler.deleteAllTs(tableAname, rowAname, columnAname, highTS + 999); - assertEquals(0, handler.getRow(tableAname, rowAname).size()); + handler.deleteAllTs(tableAname, rowAname, columnAname, highTS + 999, null); + assertEquals(0, handler.getRow(tableAname, rowAname, null).size()); // Testing mutateRowTs. for (boolean firstIsDeletion : HConstants.BOOLEAN_VALUES) { @@ -338,16 +341,16 @@ public class TestThriftServer { HConstants.LATEST_TIMESTAMP)); mutations.add(new Mutation(secondIsDeletion, columnAname, valueAname, true, highTS + 1200)); - handler.mutateRowTs(tableAname, rowAname, mutations, highTS + 1100, null); - results = handler.getRow(tableAname, rowAname); + handler.mutateRowTs(tableAname, rowAname, mutations, highTS + 1100, null, null); + results = handler.getRow(tableAname, rowAname, null); if (secondIsDeletion) { assertEquals(0, results.size()); } else { assertEquals(1, results.size()); assertBufferEquals(valueAname, results.get(0).getColumns().get(columnAname).value); } - handler.deleteAllRowTs(tableAname, rowAname, highTS + 10000); - assertEquals(0, handler.getRow(tableAname, rowAname).size()); + handler.deleteAllRowTs(tableAname, rowAname, highTS + 10000, null); + assertEquals(0, handler.getRow(tableAname, rowAname, null).size()); highTS += 20000; } } @@ -376,16 +379,16 @@ public class TestThriftServer { try { // Apply timestamped Mutations to rowA long time1 = System.currentTimeMillis(); - handler.mutateRowTs(tableAname, rowAname, getMutations(), time1, null); + handler.mutateRowTs(tableAname, rowAname, getMutations(), time1, null, null); Thread.sleep(1000); // Apply timestamped BatchMutations for rowA and rowB long time2 = System.currentTimeMillis(); - handler.mutateRowsTs(tableAname, getBatchMutations(), time2, null); + handler.mutateRowsTs(tableAname, getBatchMutations(), time2, null, null); // Apply an overlapping timestamped mutation to rowB - handler.mutateRowTs(tableAname, rowBname, getMutations(), time2, null); + handler.mutateRowTs(tableAname, rowBname, getMutations(), time2, null, null); // the getVerTs is [inf, ts) so you need to increment one. time1 += 1; @@ -393,12 +396,12 @@ public class TestThriftServer { // Assert that the timestamp-related methods retrieve the correct data assertEquals(2, handler.getVerTs(tableAname, rowAname, columnBname, time2, - MAXVERSIONS).size()); + MAXVERSIONS, null).size()); assertEquals(1, handler.getVerTs(tableAname, rowAname, columnBname, time1, - MAXVERSIONS).size()); + MAXVERSIONS, null).size()); - TRowResult rowResult1 = handler.getRowTs(tableAname, rowAname, time1).get(0); - TRowResult rowResult2 = handler.getRowTs(tableAname, rowAname, time2).get(0); + TRowResult rowResult1 = handler.getRowTs(tableAname, rowAname, time1, null).get(0); + TRowResult rowResult2 = handler.getRowTs(tableAname, rowAname, time2, null).get(0); // columnA was completely deleted //assertTrue(Bytes.equals(rowResult1.columns.get(columnAname).value, valueAname)); assertBufferEquals(rowResult1.columns.get(columnBname).value, valueBname); @@ -410,31 +413,33 @@ public class TestThriftServer { List columns = new ArrayList(); columns.add(columnBname); - rowResult1 = handler.getRowWithColumns(tableAname, rowAname, columns).get(0); + rowResult1 = handler.getRowWithColumns(tableAname, rowAname, columns, null).get(0); assertBufferEquals(rowResult1.columns.get(columnBname).value, valueCname); assertFalse(rowResult1.columns.containsKey(columnAname)); - rowResult1 = handler.getRowWithColumnsTs(tableAname, rowAname, columns, time1).get(0); + rowResult1 = handler.getRowWithColumnsTs(tableAname, rowAname, columns, time1, null).get(0); assertBufferEquals(rowResult1.columns.get(columnBname).value, valueBname); assertFalse(rowResult1.columns.containsKey(columnAname)); // Apply some timestamped deletes // this actually deletes _everything_. // nukes everything in columnB: forever. - handler.deleteAllTs(tableAname, rowAname, columnBname, time1); - handler.deleteAllRowTs(tableAname, rowBname, time2); + handler.deleteAllTs(tableAname, rowAname, columnBname, time1, null); + handler.deleteAllRowTs(tableAname, rowBname, time2, null); // Assert that the timestamp-related methods retrieve the correct data - int size = handler.getVerTs(tableAname, rowAname, columnBname, time1, MAXVERSIONS).size(); + int size = handler.getVerTs(tableAname, rowAname, columnBname, time1, MAXVERSIONS, + null).size(); assertEquals(0, size); - size = handler.getVerTs(tableAname, rowAname, columnBname, time2, MAXVERSIONS).size(); + size = handler.getVerTs(tableAname, rowAname, columnBname, time2, MAXVERSIONS, null).size(); assertEquals(1, size); // should be available.... - assertBufferEquals(handler.get(tableAname, rowAname, columnBname).get(0).value, valueCname); + assertBufferEquals(handler.get(tableAname, rowAname, columnBname, null).get(0).value, + valueCname); - assertEquals(0, handler.getRow(tableAname, rowBname).size()); + assertEquals(0, handler.getRow(tableAname, rowBname, null).size()); } finally { // Teardown handler.disableTable(tableAname); @@ -458,7 +463,7 @@ public class TestThriftServer { try { // Apply timestamped Mutations to rowA long time1 = System.currentTimeMillis(); - handler.mutateRowTs(tableAname, rowAname, getMutations(), time1, null); + handler.mutateRowTs(tableAname, rowAname, getMutations(), time1, null, null); // Sleep to assure that 'time1' and 'time2' will be different even with a // coarse grained system timer. @@ -466,7 +471,7 @@ public class TestThriftServer { // Apply timestamped BatchMutations for rowA and rowB long time2 = System.currentTimeMillis(); - handler.mutateRowsTs(tableAname, getBatchMutations(), time2, null); + handler.mutateRowsTs(tableAname, getBatchMutations(), time2, null, null); time1 += 1; @@ -568,7 +573,7 @@ public class TestThriftServer { // Create tableA and add two columns to rowA handler.createTable(tableAname, getColumnDescriptors()); try { - handler.mutateRow(tableAname, rowAname, getMutations(), null); + handler.mutateRow(tableAname, rowAname, getMutations(), null, null); byte[] searchRow = HRegionInfo.createRegionName( tableAname.array(), rowAname.array(), HConstants.NINES, false); TRegionInfo regionInfo = handler.getRegionInfo(ByteBuffer.wrap(searchRow)); Modified: hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServerLegacy.java URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServerLegacy.java?rev=1387310&r1=1387309&r2=1387310&view=diff ============================================================================== --- hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServerLegacy.java (original) +++ hbase/branches/0.89-fb/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServerLegacy.java Tue Sep 18 18:39:54 2012 @@ -146,11 +146,12 @@ public class TestThriftServerLegacy exte // Apply a few Mutations to rowA // mutations.add(new Mutation(false, columnAname, valueAname)); // mutations.add(new Mutation(false, columnBname, valueBname)); - handler.mutateRow(tableAname, rowAname, getMutations(), null); + handler.mutateRow(tableAname, rowAname, getMutations(), null, null); // Assert that the changes were made - assertBufferEquals(valueAname, handler.get(tableAname, rowAname, columnAname).get(0).value); - TRowResult rowResult1 = handler.getRow(tableAname, rowAname).get(0); + assertBufferEquals(valueAname, handler.get(tableAname, rowAname, columnAname, + null).get(0).value); + TRowResult rowResult1 = handler.getRow(tableAname, rowAname, null).get(0); assertBufferEquals(rowAname, rowResult1.row); assertBufferEquals(valueBname, rowResult1.columns.get(columnBname).value); @@ -162,37 +163,38 @@ public class TestThriftServerLegacy exte // rowBmutations.add(new Mutation(false, columnAname, valueCname)); // rowBmutations.add(new Mutation(false, columnBname, valueDname)); // batchMutations.add(new BatchMutation(rowBname, rowBmutations)); - handler.mutateRows(tableAname, getBatchMutations(), null); + handler.mutateRows(tableAname, getBatchMutations(), null, null); // Assert that changes were made to rowA - List cells = handler.get(tableAname, rowAname, columnAname); + List cells = handler.get(tableAname, rowAname, columnAname, null); assertFalse(cells.size() > 0); - assertBufferEquals(valueCname, handler.get(tableAname, rowAname, columnBname).get(0).value); - List versions = handler.getVer(tableAname, rowAname, columnBname, MAXVERSIONS); + assertBufferEquals(valueCname, handler.get(tableAname, rowAname, columnBname, + null).get(0).value); + List versions = handler.getVer(tableAname, rowAname, columnBname, MAXVERSIONS, null); assertBufferEquals(valueCname, versions.get(0).value); assertBufferEquals(valueBname, versions.get(1).value); // Assert that changes were made to rowB - TRowResult rowResult2 = handler.getRow(tableAname, rowBname).get(0); + TRowResult rowResult2 = handler.getRow(tableAname, rowBname, null).get(0); assertBufferEquals(rowBname, rowResult2.row); assertBufferEquals(valueCname, rowResult2.columns.get(columnAname).value); assertBufferEquals(valueDname, rowResult2.columns.get(columnBname).value); // Apply some deletes - handler.deleteAll(tableAname, rowAname, columnBname); - handler.deleteAllRow(tableAname, rowBname, null); + handler.deleteAll(tableAname, rowAname, columnBname, null); + handler.deleteAllRow(tableAname, rowBname, null, null); // Assert that the deletes were applied - int size = handler.get(tableAname, rowAname, columnBname).size(); + int size = handler.get(tableAname, rowAname, columnBname, null).size(); assertEquals(0, size); - size = handler.getRow(tableAname, rowBname).size(); + size = handler.getRow(tableAname, rowBname, null).size(); assertEquals(0, size); // Try null mutation List mutations = new ArrayList(); mutations.add(new Mutation(false, columnAname, null, true, HConstants.LATEST_TIMESTAMP)); - handler.mutateRow(tableAname, rowAname, mutations, null); - TRowResult rowResult3 = handler.getRow(tableAname, rowAname).get(0); + handler.mutateRow(tableAname, rowAname, mutations, null, null); + TRowResult rowResult3 = handler.getRow(tableAname, rowAname, null).get(0); assertEquals(rowAname, rowResult3.row); assertEquals(0, rowResult3.columns.get(columnAname).value.remaining()); @@ -215,16 +217,16 @@ public class TestThriftServerLegacy exte // Apply timestamped Mutations to rowA long time1 = System.currentTimeMillis(); - handler.mutateRowTs(tableAname, rowAname, getMutations(), time1, null); + handler.mutateRowTs(tableAname, rowAname, getMutations(), time1, null, null); Thread.sleep(1000); // Apply timestamped BatchMutations for rowA and rowB long time2 = System.currentTimeMillis(); - handler.mutateRowsTs(tableAname, getBatchMutations(), time2, null); + handler.mutateRowsTs(tableAname, getBatchMutations(), time2, null, null); // Apply an overlapping timestamped mutation to rowB - handler.mutateRowTs(tableAname, rowBname, getMutations(), time2, null); + handler.mutateRowTs(tableAname, rowBname, getMutations(), time2, null, null); // the getVerTs is [inf, ts) so you need to increment one. time1 += 1; @@ -232,12 +234,12 @@ public class TestThriftServerLegacy exte // Assert that the timestamp-related methods retrieve the correct data assertEquals(2, handler.getVerTs(tableAname, rowAname, columnBname, time2, - MAXVERSIONS).size()); + MAXVERSIONS, null).size()); assertEquals(1, handler.getVerTs(tableAname, rowAname, columnBname, time1, - MAXVERSIONS).size()); + MAXVERSIONS, null).size()); - TRowResult rowResult1 = handler.getRowTs(tableAname, rowAname, time1).get(0); - TRowResult rowResult2 = handler.getRowTs(tableAname, rowAname, time2).get(0); + TRowResult rowResult1 = handler.getRowTs(tableAname, rowAname, time1, null).get(0); + TRowResult rowResult2 = handler.getRowTs(tableAname, rowAname, time2, null).get(0); // columnA was completely deleted //assertBufferEquals(rowResult1.columns.get(columnAname).value, valueAname); assertBufferEquals(rowResult1.columns.get(columnBname).value, valueBname); @@ -249,31 +251,34 @@ public class TestThriftServerLegacy exte List columns = new ArrayList(); columns.add(columnBname); - rowResult1 = handler.getRowWithColumns(tableAname, rowAname, columns).get(0); + rowResult1 = handler.getRowWithColumns(tableAname, rowAname, columns, null).get(0); assertBufferEquals(rowResult1.columns.get(columnBname).value, valueCname); assertFalse(rowResult1.columns.containsKey(columnAname)); - rowResult1 = handler.getRowWithColumnsTs(tableAname, rowAname, columns, time1).get(0); + rowResult1 = handler.getRowWithColumnsTs(tableAname, rowAname, columns, time1, null).get(0); assertBufferEquals(rowResult1.columns.get(columnBname).value, valueBname); assertFalse(rowResult1.columns.containsKey(columnAname)); // Apply some timestamped deletes // this actually deletes _everything_. // nukes everything in columnB: forever. - handler.deleteAllTs(tableAname, rowAname, columnBname, time1); - handler.deleteAllRowTs(tableAname, rowBname, time2); + handler.deleteAllTs(tableAname, rowAname, columnBname, time1, null); + handler.deleteAllRowTs(tableAname, rowBname, time2, null); // Assert that the timestamp-related methods retrieve the correct data - int size = handler.getVerTs(tableAname, rowAname, columnBname, time1, MAXVERSIONS).size(); + int size = handler.getVerTs(tableAname, rowAname, columnBname, time1, MAXVERSIONS, + null).size(); assertEquals(0, size); - size = handler.getVerTs(tableAname, rowAname, columnBname, time2, MAXVERSIONS).size(); + size = handler.getVerTs(tableAname, rowAname, columnBname, time2, MAXVERSIONS, + null).size(); assertEquals(1, size); // should be available.... - assertBufferEquals(handler.get(tableAname, rowAname, columnBname).get(0).value, valueCname); + assertBufferEquals(handler.get(tableAname, rowAname, columnBname, null).get(0).value, + valueCname); - assertEquals(0, handler.getRow(tableAname, rowBname).size()); + assertEquals(0, handler.getRow(tableAname, rowBname, null).size()); // Teardown handler.disableTable(tableAname); @@ -293,7 +298,7 @@ public class TestThriftServerLegacy exte // Apply timestamped Mutations to rowA long time1 = System.currentTimeMillis(); - handler.mutateRowTs(tableAname, rowAname, getMutations(), time1, null); + handler.mutateRowTs(tableAname, rowAname, getMutations(), time1, null, null); // Sleep to assure that 'time1' and 'time2' will be different even with a // coarse grained system timer. @@ -301,7 +306,7 @@ public class TestThriftServerLegacy exte // Apply timestamped BatchMutations for rowA and rowB long time2 = System.currentTimeMillis(); - handler.mutateRowsTs(tableAname, getBatchMutations(), time2, null); + handler.mutateRowsTs(tableAname, getBatchMutations(), time2, null, null); time1 += 1; @@ -360,7 +365,7 @@ public class TestThriftServerLegacy exte // Apply timestamped Mutations to rowA long time1 = System.currentTimeMillis(); - handler.mutateRowTs(tableAname, rowAname, getMutations(), time1, null); + handler.mutateRowTs(tableAname, rowAname, getMutations(), time1, null, null); // Sleep to assure that 'time1' and 'time2' will be different even with a // coarse grained system timer. @@ -368,7 +373,7 @@ public class TestThriftServerLegacy exte // Apply timestamped BatchMutations for rowA and rowB long time2 = System.currentTimeMillis(); - handler.mutateRowsTs(tableAname, getBatchMutations(), time2, null); + handler.mutateRowsTs(tableAname, getBatchMutations(), time2, null, null); time1 += 1; @@ -377,7 +382,7 @@ public class TestThriftServerLegacy exte rows.add(rowAname); rows.add(rowBname); - List results = handler.getRows(tableAname, rows); + List results = handler.getRows(tableAname, rows, null); assertEquals(results.get(0).row, rowAname); assertEquals(results.get(1).row, rowBname); @@ -405,7 +410,7 @@ public class TestThriftServerLegacy exte handler.checkAndMutateRowTs(tableAname, rowAname, columnAname, null, getMutations(), time1, null); - List res1 = handler.getRow(tableAname, rowAname); + List res1 = handler.getRow(tableAname, rowAname, null); // Check that all went according to plan assertEquals(res1.get(0).columns.get(columnAname).value, valueAname); assertEquals(res1.get(0).columns.get(columnBname).value, valueBname); @@ -441,7 +446,7 @@ public class TestThriftServerLegacy exte handler.checkAndMutateRowTs(tableAname, rowAname, columnAname, valueAname, getMutations2(), time2, null); - res1 = handler.getRow(tableAname, rowAname); + res1 = handler.getRow(tableAname, rowAname, null); // Check that actually changed! assertEquals(res1.get(0).columns.get(columnAname).value, valueCname);