/** * Split the mutation into batches based on the timestamps of each keyvalue. We need to check each key-value in the * update to see if it matches the others. Generally, this will be the case, but you can add kvs to a mutation that * don't all have the timestamp, so we need to manage everything in batches based on timestamp. * <p> * Adds all the updates in the {@link Mutation} to the state, as a side-effect. * @param state * current state of the row for the mutation. * @param m * mutation to batch * @param indexMetaData TODO * @param updateMap * index updates into which to add new updates. Modified as a side-effect. * * @throws IOException */ private void batchMutationAndAddUpdates(IndexUpdateManager manager, LocalTableState state, Mutation m, IndexMetaData indexMetaData) throws IOException { // The cells of a mutation are broken up into time stamp batches prior to this call (in Indexer). long ts = m.getFamilyCellMap().values().iterator().next().iterator().next().getTimestamp(); Batch batch = new Batch(ts); for (List<Cell> family : m.getFamilyCellMap().values()) { for (Cell kv : family) { batch.add(kv); if(ts != kv.getTimestamp()) { throw new IllegalStateException("Time stamps must match for all cells in a batch"); } } } addMutationsForBatch(manager, batch, state, indexMetaData); }
/** * Split the mutation into batches based on the timestamps of each keyvalue. We need to check each key-value in the * update to see if it matches the others. Generally, this will be the case, but you can add kvs to a mutation that * don't all have the timestamp, so we need to manage everything in batches based on timestamp. * <p> * Adds all the updates in the {@link Mutation} to the state, as a side-effect. * @param state * current state of the row for the mutation. * @param m * mutation to batch * @param indexMetaData TODO * @param updateMap * index updates into which to add new updates. Modified as a side-effect. * * @throws IOException */ private void batchMutationAndAddUpdates(IndexUpdateManager manager, LocalTableState state, Mutation m, IndexMetaData indexMetaData) throws IOException { // The cells of a mutation are broken up into time stamp batches prior to this call (in Indexer). long ts = m.getFamilyCellMap().values().iterator().next().iterator().next().getTimestamp(); Batch batch = new Batch(ts); for (List<Cell> family : m.getFamilyCellMap().values()) { for (Cell kv : family) { batch.add(kv); if(ts != kv.getTimestamp()) { throw new IllegalStateException("Time stamps must match for all cells in a batch"); } } } addMutationsForBatch(manager, batch, state, indexMetaData); }
/** * Split the mutation into batches based on the timestamps of each keyvalue. We need to check each key-value in the * update to see if it matches the others. Generally, this will be the case, but you can add kvs to a mutation that * don't all have the timestamp, so we need to manage everything in batches based on timestamp. * <p> * Adds all the updates in the {@link Mutation} to the state, as a side-effect. * @param state * current state of the row for the mutation. * @param m * mutation to batch * @param indexMetaData TODO * @param updateMap * index updates into which to add new updates. Modified as a side-effect. * * @throws IOException */ private void batchMutationAndAddUpdates(IndexUpdateManager manager, LocalTableState state, Mutation m, IndexMetaData indexMetaData) throws IOException { // The cells of a mutation are broken up into time stamp batches prior to this call (in Indexer). long ts = m.getFamilyCellMap().values().iterator().next().iterator().next().getTimestamp(); Batch batch = new Batch(ts); for (List<Cell> family : m.getFamilyCellMap().values()) { for (Cell kv : family) { batch.add(kv); if(ts != kv.getTimestamp()) { throw new IllegalStateException("Time stamps must match for all cells in a batch"); } } } addMutationsForBatch(manager, batch, state, indexMetaData); }