@Test public void testGetMutableIndexUpdate() throws IOException { setCurrentRowState(FAM, INDEXED_QUALIFIER, 1, VALUE_1); Put put = new Put(ROW); put.addImmutable(FAM, INDEXED_QUALIFIER, 2, VALUE_2); MultiMutation mutation = new MultiMutation(new ImmutableBytesPtr(ROW)); mutation.addAll(put); CachedLocalTable cachedLocalTable = CachedLocalTable.build( Collections.singletonList(mutation), this.mockIndexMetaData, this.indexBuilder.getEnv().getRegion()); Collection<Pair<Mutation, byte[]>> indexUpdates = indexBuilder.getIndexUpdate(mutation, mockIndexMetaData, cachedLocalTable); assertEquals(2, indexUpdates.size()); assertContains(indexUpdates, 2, ROW, KeyValue.Type.DeleteFamily, FAM, new byte[0] , 2); assertContains(indexUpdates, ColumnTracker.NO_NEWER_PRIMARY_TABLE_ENTRY_TIMESTAMP, ROW, KeyValue.Type.Put, FAM, QueryConstants.EMPTY_COLUMN_BYTES, 2); }
@Override public Collection<Pair<Mutation, byte[]>> getIndexUpdate(Mutation mutation, IndexMetaData indexMetaData, LocalHBaseState localHBaseState) throws IOException { LocalTableState state = new LocalTableState(localHBaseState, mutation); IndexUpdateManager manager = new IndexUpdateManager(indexMetaData); batchMutationAndAddUpdates(manager, state, mutation, indexMetaData); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Found index updates for Mutation: " + mutation + "\n" + manager); } return manager.toMap(); }
NonTxIndexBuilder extends BaseIndexBuilder { @Override public Collection<Pair<Mutation, byte[]>> getIndexUpdate(Mutation mutation, IndexMetaData indexMetaData, LocalHBaseState localHBaseState) throws IOException { LocalTableState state = new LocalTableState(localHBaseState, mutation); IndexUpdateManager manager = new IndexUpdateManager(indexMetaData); batchMutationAndAddUpdates(manager, state, mutation, indexMetaData); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Found index updates for Mutation: " + mutation + "\n" + manager); } return manager.toMap(); } }
NonTxIndexBuilder extends BaseIndexBuilder { @Override public Collection<Pair<Mutation, byte[]>> getIndexUpdate(Mutation mutation, IndexMetaData indexMetaData, LocalHBaseState localHBaseState) throws IOException { LocalTableState state = new LocalTableState(localHBaseState, mutation); IndexUpdateManager manager = new IndexUpdateManager(indexMetaData); batchMutationAndAddUpdates(manager, state, mutation, indexMetaData); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Found index updates for Mutation: " + mutation + "\n" + manager); } return manager.toMap(); }  }
NonTxIndexBuilder extends BaseIndexBuilder { @Override public Collection<Pair<Mutation, byte[]>> getIndexUpdate(Mutation mutation, IndexMetaData indexMetaData, LocalHBaseState localHBaseState) throws IOException { LocalTableState state = new LocalTableState(localHBaseState, mutation); IndexUpdateManager manager = new IndexUpdateManager(indexMetaData); batchMutationAndAddUpdates(manager, state, mutation, indexMetaData); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Found index updates for Mutation: " + mutation + "\n" + manager); } return manager.toMap(); }  @Override void setup(RegionCoprocessorEnvironment env); @Override Collection<Pair<Mutation, byte[]>> getIndexUpdate(Mutation mutation, IndexMetaData indexMetaData, LocalHBaseState localHBaseState); @Override Collection<Pair<Mutation, byte[]>> getIndexUpdateForFilteredRows(Collection<Cell> filtered, IndexMetaData indexMetaData); }
NonTxIndexBuilder extends BaseIndexBuilder { @Override public Collection<Pair<Mutation, byte[]>> getIndexUpdate(Mutation mutation, IndexMetaData indexMetaData, LocalHBaseState localHBaseState) throws IOException { LocalTableState state = new LocalTableState(localHBaseState, mutation); IndexUpdateManager manager = new IndexUpdateManager(indexMetaData); batchMutationAndAddUpdates(manager, state, mutation, indexMetaData); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Found index updates for Mutation: " + mutation + "\n" + manager); } return manager.toMap(); }  @Override void setup(RegionCoprocessorEnvironment env); @Override Collection<Pair<Mutation, byte[]>> getIndexUpdate(Mutation mutation, IndexMetaData indexMetaData, LocalHBaseState localHBaseState); @Override Collection<Pair<Mutation, byte[]>> getIndexUpdateForFilteredRows(Collection<Cell> filtered, IndexMetaData indexMetaData);  }