@Test(timeout = 10000) public void testManyVersions() throws IOException { Mockito.when(mockIndexMetaData.getReplayWrite()).thenReturn(ReplayWrite.INDEX_ONLY); MultiMutation mutation = getMultipleVersionMutation(200); currentRowCells = mutation.getFamilyCellMap().get(FAM); Collection<? extends Mutation> mutations = IndexManagementUtil.flattenMutationsByTimestamp(Collections.singletonList(mutation)); CachedLocalTable cachedLocalTable = CachedLocalTable.build( mutations, this.mockIndexMetaData, this.indexBuilder.getEnv().getRegion()); Collection<Pair<Mutation, byte[]>> indexUpdates = Lists.newArrayList(); for (Mutation m : IndexManagementUtil.flattenMutationsByTimestamp(Collections.singletonList(mutation))) { indexUpdates.addAll(indexBuilder.getIndexUpdate(m, mockIndexMetaData, cachedLocalTable)); } assertNotEquals(0, indexUpdates.size()); }
@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);  }