|
17 | 17 |
|
18 | 18 | package com.alipay.oceanbase.hbase;
|
19 | 19 |
|
| 20 | +import com.alipay.oceanbase.rpc.mutation.result.MutationResult; |
20 | 21 | import org.apache.hadoop.hbase.Cell;
|
21 | 22 | import org.apache.hadoop.hbase.CellUtil;
|
22 |
| -import org.apache.hadoop.hbase.KeyValue; |
23 | 23 | import org.apache.hadoop.hbase.client.*;
|
| 24 | +import org.apache.hadoop.hbase.client.coprocessor.Batch; |
24 | 25 | import org.apache.hadoop.hbase.filter.PrefixFilter;
|
25 | 26 | import org.junit.*;
|
26 | 27 | import org.junit.rules.ExpectedException;
|
@@ -152,6 +153,32 @@ public void testMultiColumnFamilyBatch() throws Exception {
|
152 | 153 | result = hTable.get(get);
|
153 | 154 | keyValues = result.rawCells();
|
154 | 155 | assertEquals(6, keyValues.length);
|
| 156 | + |
| 157 | + batchLsit.clear(); |
| 158 | + final long[] updateCounter = new long[] { 0L }; |
| 159 | + delete = new Delete(toBytes("Key5")); |
| 160 | + delete.deleteColumns(family1, family1_column2); |
| 161 | + delete.deleteColumns(family2, family2_column1); |
| 162 | + delete.deleteFamily(family3); |
| 163 | + batchLsit.add(delete); |
| 164 | + for (int i = 0; i < rows; ++i) { |
| 165 | + Put put = new Put(toBytes("Key" + i)); |
| 166 | + put.add(family1, family1_column1, family1_value); |
| 167 | + put.add(family1, family1_column2, family1_value); |
| 168 | + put.add(family1, family1_column3, family1_value); |
| 169 | + put.add(family2, family2_column1, family2_value); |
| 170 | + put.add(family2, family2_column2, family2_value); |
| 171 | + put.add(family3, family3_column1, family3_value); |
| 172 | + batchLsit.add(put); |
| 173 | + } |
| 174 | + hTable.batchCallback(batchLsit, new Batch.Callback<MutationResult>() { |
| 175 | + @Override |
| 176 | + public void update(byte[] region, byte[] row, MutationResult result) { |
| 177 | + updateCounter[0]++; |
| 178 | + } |
| 179 | + }); |
| 180 | + assertEquals(11, updateCounter[0]); |
| 181 | + |
155 | 182 | }
|
156 | 183 |
|
157 | 184 | @Test
|
|
0 commit comments