HBASE-4679 Thrift null mutation error

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1190143 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nicolas Spiegelberg 2011-10-28 03:29:52 +00:00
parent 2e6de1360a
commit 0e83d7445d
3 changed files with 21 additions and 4 deletions

View File

@ -414,6 +414,7 @@ Release 0.92.0 - Unreleased
of ArithmeticException: / by zero.
HBASE-4300 Start of new-version master fails if old master's znode is
hanging around
HBASE-4679 Thrift null mutation error
TESTS
HBASE-4450 test for number of blocks read: to serve as baseline for expected

View File

@ -597,9 +597,13 @@ public class ThriftServer {
}
} else {
if(famAndQf.length == 1) {
put.add(famAndQf[0], new byte[0], getBytes(m.value));
put.add(famAndQf[0], HConstants.EMPTY_BYTE_ARRAY,
m.value != null ? m.value.array()
: HConstants.EMPTY_BYTE_ARRAY);
} else {
put.add(famAndQf[0], famAndQf[1], getBytes(m.value));
put.add(famAndQf[0], famAndQf[1],
m.value != null ? m.value.array()
: HConstants.EMPTY_BYTE_ARRAY);
}
}
}
@ -642,9 +646,13 @@ public class ThriftServer {
}
} else {
if(famAndQf.length == 1) {
put.add(famAndQf[0], new byte[0], getBytes(m.value));
put.add(famAndQf[0], HConstants.EMPTY_BYTE_ARRAY,
m.value != null ? m.value.array()
: HConstants.EMPTY_BYTE_ARRAY);
} else {
put.add(famAndQf[0], famAndQf[1], getBytes(m.value));
put.add(famAndQf[0], famAndQf[1],
m.value != null ? m.value.array()
: HConstants.EMPTY_BYTE_ARRAY);
}
}
}

View File

@ -179,6 +179,14 @@ public class TestThriftServer {
size = handler.getRow(tableAname, rowBname).size();
assertEquals(0, size);
// Try null mutation
List<Mutation> mutations = new ArrayList<Mutation>();
mutations.add(new Mutation(false, columnAname, null));
handler.mutateRow(tableAname, rowAname, mutations);
TRowResult rowResult3 = handler.getRow(tableAname, rowAname).get(0);
assertEquals(rowAname, rowResult3.row);
assertEquals(0, rowResult3.columns.get(columnAname).value.array().length);
// Teardown
handler.disableTable(tableAname);
handler.deleteTable(tableAname);