ThemisCpUtil { public static Pair<List<KeyValue>, List<KeyValue>> seperateLockAndWriteKvs(List<KeyValue> kvs) { List<KeyValue> lockKvs = new ArrayList<KeyValue>(); List<KeyValue> writeKvs = new ArrayList<KeyValue>(); if (kvs != null) { for (KeyValue kv : kvs) { if (ColumnUtil.isLockColumn(kv.getFamily(), kv.getQualifier())) { lockKvs.add(kv); } else if (ColumnUtil.isWriteColumn(kv.getFamily(), kv.getQualifier())) { writeKvs.add(kv); } } } return new Pair<List<KeyValue>, List<KeyValue>>(lockKvs, writeKvs); }  static String getDisallowedFilterClassNameString(); static void processFilters(Filter filter, FilterCallable callable); static void moveRowkeyFiltersForWriteGet(Get sourceGet, Get destGet); static void moveRowkeyFiltersForWriteScan(Scan sourceScan, Scan destScan); static void addLockAndWriteColumnToGet(Get userGet, Get internalGet, long startTs); static Result removeNotRequiredLockColumns(Map<byte[], NavigableSet<byte[]>> familyMap,
      Result result); static Get constructLockAndWriteGet(Get userGet, long startTs); static void prepareGet(Get get, Collection<HColumnDescriptor> families); static void prepareScan(Scan scan, Collection<HColumnDescriptor> families); static Scan constructLockAndWriteScan(Scan userScan, long startTs); static void addLockAndWriteColumnToScan(Column column, Scan scan); static Get constructDataGetByPutKvs(List<KeyValue> putKvs, Filter filter); static void addWriteColumnToGet(Column column, Get get); static boolean isLockResult(Result result); static Pair<List<KeyValue>, List<KeyValue>> seperateLockAndWriteKvs(List<KeyValue> kvs); static Set<Class<? extends Filter>> ALLOWED_ROWKEY_FILTER_CLASSES; static Set<Class<? extends Filter>> DISALLOWD_FILTERS; }
@Test public void testSeperateLockAndWriteKvs() { List<KeyValue> kvs = new ArrayList<KeyValue>(); kvs.add(KEYVALUE); kvs.add(getLockKv(KEYVALUE)); kvs.add(getPutKv(KEYVALUE)); Column column = ColumnUtil.getDeleteColumn(new Column(FAMILY, QUALIFIER)); KeyValue deleteKv = new KeyValue(ROW, column.getFamily(), column.getQualifier(), PREWRITE_TS, Type.Put, VALUE); kvs.add(deleteKv); Pair<List<KeyValue>, List<KeyValue>> result = ThemisCpUtil.seperateLockAndWriteKvs(kvs); Assert.assertEquals(1, result.getFirst().size()); Assert.assertTrue(getLockKv(KEYVALUE).equals(result.getFirst().get(0))); Assert.assertEquals(2, result.getSecond().size()); Assert.assertTrue(getPutKv(KEYVALUE).equals(result.getSecond().get(0))); Assert.assertTrue(deleteKv.equals(result.getSecond().get(1))); result = ThemisCpUtil.seperateLockAndWriteKvs(null); Assert.assertEquals(0, result.getFirst().size()); Assert.assertEquals(0, result.getSecond().size()); }