HBASE-5736 ThriftServerRunner.HbaseHandler.mutateRow() does not use ByteBuffer correctly (Scott Chen)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1310634 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6d43887b88
commit
915f2cd40d
|
@ -974,11 +974,11 @@ public class ThriftServerRunner implements Runnable {
|
|||
} else {
|
||||
if(famAndQf.length == 1) {
|
||||
put.add(famAndQf[0], HConstants.EMPTY_BYTE_ARRAY,
|
||||
m.value != null ? m.value.array()
|
||||
m.value != null ? getBytes(m.value)
|
||||
: HConstants.EMPTY_BYTE_ARRAY);
|
||||
} else {
|
||||
put.add(famAndQf[0], famAndQf[1],
|
||||
m.value != null ? m.value.array()
|
||||
m.value != null ? getBytes(m.value)
|
||||
: HConstants.EMPTY_BYTE_ARRAY);
|
||||
}
|
||||
put.setWriteToWAL(m.writeToWAL);
|
||||
|
@ -1032,11 +1032,11 @@ public class ThriftServerRunner implements Runnable {
|
|||
} else {
|
||||
if(famAndQf.length == 1) {
|
||||
put.add(famAndQf[0], HConstants.EMPTY_BYTE_ARRAY,
|
||||
m.value != null ? m.value.array()
|
||||
m.value != null ? getBytes(m.value)
|
||||
: HConstants.EMPTY_BYTE_ARRAY);
|
||||
} else {
|
||||
put.add(famAndQf[0], famAndQf[1],
|
||||
m.value != null ? m.value.array()
|
||||
m.value != null ? getBytes(m.value)
|
||||
: HConstants.EMPTY_BYTE_ARRAY);
|
||||
}
|
||||
put.setWriteToWAL(m.writeToWAL);
|
||||
|
@ -1401,8 +1401,8 @@ public class ThriftServerRunner implements Runnable {
|
|||
return;
|
||||
}
|
||||
for (Map.Entry<ByteBuffer, ByteBuffer> entry : attributes.entrySet()) {
|
||||
String name = Bytes.toStringBinary(entry.getKey());
|
||||
byte[] value = Bytes.toBytes(entry.getValue());
|
||||
String name = Bytes.toStringBinary(getBytes(entry.getKey()));
|
||||
byte[] value = getBytes(entry.getValue());
|
||||
op.setAttribute(name, value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -209,9 +209,13 @@ public class TestThriftServer {
|
|||
* @throws Exception
|
||||
*/
|
||||
public void doTestTableMutations() throws Exception {
|
||||
// Setup
|
||||
ThriftServerRunner.HBaseHandler handler =
|
||||
new ThriftServerRunner.HBaseHandler(UTIL.getConfiguration());
|
||||
doTestTableMutations(handler);
|
||||
}
|
||||
|
||||
public static void doTestTableMutations(Hbase.Iface handler) throws Exception {
|
||||
// Setup
|
||||
handler.createTable(tableAname, getColumnDescriptors());
|
||||
|
||||
// Apply a few Mutations to rowA
|
||||
|
@ -267,7 +271,7 @@ public class TestThriftServer {
|
|||
handler.mutateRow(tableAname, rowAname, mutations, null);
|
||||
TRowResult rowResult3 = handler.getRow(tableAname, rowAname, null).get(0);
|
||||
assertEquals(rowAname, rowResult3.row);
|
||||
assertEquals(0, rowResult3.columns.get(columnAname).value.array().length);
|
||||
assertEquals(0, rowResult3.columns.get(columnAname).value.remaining());
|
||||
|
||||
// Teardown
|
||||
handler.disableTable(tableAname);
|
||||
|
@ -540,7 +544,7 @@ public class TestThriftServer {
|
|||
* (rowB, columnA): place valueC
|
||||
* (rowB, columnB): place valueD
|
||||
*/
|
||||
private List<BatchMutation> getBatchMutations() {
|
||||
private static List<BatchMutation> getBatchMutations() {
|
||||
List<BatchMutation> batchMutations = new ArrayList<BatchMutation>();
|
||||
|
||||
// Mutations to rowA. You can't mix delete and put anymore.
|
||||
|
|
|
@ -58,7 +58,7 @@ import com.google.common.base.Joiner;
|
|||
@RunWith(Parameterized.class)
|
||||
public class TestThriftServerCmdLine {
|
||||
|
||||
public static final Log LOG =
|
||||
public static final Log LOG =
|
||||
LogFactory.getLog(TestThriftServerCmdLine.class);
|
||||
|
||||
private final ImplType implType;
|
||||
|
@ -71,7 +71,7 @@ public class TestThriftServerCmdLine {
|
|||
|
||||
private Thread cmdLineThread;
|
||||
private volatile Exception cmdLineException;
|
||||
|
||||
|
||||
private Exception clientSideException;
|
||||
|
||||
private ThriftServer thriftServer;
|
||||
|
@ -142,7 +142,7 @@ public class TestThriftServerCmdLine {
|
|||
cmdLineThread.start();
|
||||
}
|
||||
|
||||
@Test(timeout=30 * 1000)
|
||||
@Test(timeout=60 * 1000)
|
||||
public void testRunThriftServer() throws Exception {
|
||||
List<String> args = new ArrayList<String>();
|
||||
if (implType != null) {
|
||||
|
@ -209,6 +209,7 @@ public class TestThriftServerCmdLine {
|
|||
TestThriftServer.doTestTableCreateDrop(client);
|
||||
TestThriftServer.doTestGetRegionInfo(client);
|
||||
TestThriftServer.doTestGetTableRegions(client);
|
||||
TestThriftServer.doTestTableMutations(client);
|
||||
} finally {
|
||||
sock.close();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue