ThemisCpUtil { public static Result removeNotRequiredLockColumns(Map<byte[], NavigableSet<byte[]>> familyMap, Result result) { if (!result.isEmpty()) { List<KeyValue> kvs = new ArrayList<KeyValue>(); for (KeyValue kv : result.list()) { if (Bytes.equals(ColumnUtil.LOCK_FAMILY_NAME, kv.getFamily()) || ColumnUtil.isCommitFamily(kv.getFamily())) { Column dataColumn = ColumnUtil.getDataColumnFromConstructedQualifier(new Column(kv.getFamily(), kv .getQualifier())); if (familyMap.containsKey(dataColumn.getFamily())) { Set<byte[]> qualifiers= familyMap.get(dataColumn.getFamily()); if (qualifiers == null || qualifiers.size() == 0 || qualifiers.contains(dataColumn.getQualifier())) { kvs.add(kv); } } } else { kvs.add(kv); } } if (kvs.size() != result.size()) { return new Result(kvs); } } return result; }  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 testRemoveNotRequiredLockColumns() { Get get = new Get(ROW); get.addFamily(FAMILY); get.addColumn(ANOTHER_FAMILY, ANOTHER_QUALIFIER); List<KeyValue> sourceKvs = new ArrayList<KeyValue>(); sourceKvs.add(KEYVALUE); Column lockColumn = ColumnUtil.getLockColumn(FAMILY, QUALIFIER); KeyValue lockKv = new KeyValue(ROW, lockColumn.getFamily(), lockColumn.getQualifier(), PREWRITE_TS, Type.Put, VALUE); sourceKvs.add(lockKv); lockColumn = ColumnUtil.getLockColumn(ANOTHER_FAMILY, QUALIFIER); sourceKvs.add(new KeyValue(ROW, lockColumn.getFamily(), lockColumn.getQualifier(), PREWRITE_TS, Type.Put, VALUE)); Result result = ThemisCpUtil.removeNotRequiredLockColumns(get.getFamilyMap(), new Result( sourceKvs)); Assert.assertEquals(2, result.size()); Assert.assertTrue(KEYVALUE.equals(result.list().get(0))); Assert.assertTrue(lockKv.equals(result.list().get(1))); }