private void generateDeletes(PhoenixIndexMetaData indexMetaData, Collection<Pair<Mutation, byte[]>> indexUpdates, byte[] attribValue, TxTableState state) throws IOException { byte[] regionStartKey = this.regionStartKey; byte[] regionEndKey = this.regionEndKey; if (services != null && indexMetaData.hasLocalIndexes()) { try { HRegionLocation tableRegionLocation = services.getTableRegionLocation(tableName, state.getCurrentRowKey()); regionStartKey = tableRegionLocation.getRegionInfo().getStartKey(); regionEndKey = tableRegionLocation.getRegionInfo().getEndKey(); } catch (SQLException e) { throw new IOException(e); } } Iterable<IndexUpdate> deletes = codec.getIndexDeletes(state, indexMetaData, regionStartKey, regionEndKey); for (IndexUpdate delete : deletes) { if (delete.isValid()) { delete.getUpdate().setAttribute(PhoenixTransactionContext.TX_ROLLBACK_ATTRIBUTE_KEY, attribValue); indexUpdates.add(new Pair<Mutation, byte[]>(delete.getUpdate(),delete.getTableName())); } } }
private boolean generatePuts( PhoenixIndexMetaData indexMetaData, Collection<Pair<Mutation, byte[]>> indexUpdates, TxTableState state) throws IOException { state.applyMutation(); byte[] regionStartKey = this.regionStartKey; byte[] regionEndKey = this.regionEndKey; if (services != null && indexMetaData.hasLocalIndexes()) { try { HRegionLocation tableRegionLocation = services.getTableRegionLocation(tableName, state.getCurrentRowKey()); regionStartKey = tableRegionLocation.getRegionInfo().getStartKey(); regionEndKey = tableRegionLocation.getRegionInfo().getEndKey(); } catch (SQLException e) { throw new IOException(e); } } Iterable<IndexUpdate> puts = codec.getIndexUpserts(state, indexMetaData, regionStartKey, regionEndKey); boolean validPut = false; for (IndexUpdate put : puts) { if (put.isValid()) { indexUpdates.add(new Pair<Mutation, byte[]>(put.getUpdate(),put.getTableName())); validPut = true; } } return validPut; }
Delete remove = (Delete)d.getUpdate(); remove.setTimestamp(ts); updateMap.addIndexUpdate(d.getTableName(), remove);
for (IndexUpdate update : updates) { assertTrue("Update marked as invalid, but should be a pending index write!", update.isValid()); Put m = (Put) update.getUpdate(); assertTrue("Didn't have any index cleanup, even though there is current state", update.isValid()); Delete m = (Delete) update.getUpdate();
Mutation mutation = update.getUpdate(); updateMap.addIndexUpdate(table, mutation);
private void generateDeletes(PhoenixIndexMetaData indexMetaData, Collection<Pair<Mutation, byte[]>> indexUpdates, byte[] attribValue, TxTableState state) throws IOException { Iterable<IndexUpdate> deletes = codec.getIndexDeletes(state, indexMetaData); for (IndexUpdate delete : deletes) { if (delete.isValid()) { delete.getUpdate().setAttribute(PhoenixTransactionContext.TX_ROLLBACK_ATTRIBUTE_KEY, attribValue); indexUpdates.add(new Pair<Mutation, byte[]>(delete.getUpdate(),delete.getTableName())); } } }
private boolean generatePuts( PhoenixIndexMetaData indexMetaData, Collection<Pair<Mutation, byte[]>> indexUpdates, TxTableState state) throws IOException { state.applyMutation(); Iterable<IndexUpdate> puts = codec.getIndexUpserts(state, indexMetaData); boolean validPut = false; for (IndexUpdate put : puts) { if (put.isValid()) { indexUpdates.add(new Pair<Mutation, byte[]>(put.getUpdate(),put.getTableName())); validPut = true; } } return validPut; }
private void generateDeletes(PhoenixIndexMetaData indexMetaData, Collection<Pair<Mutation, byte[]>> indexUpdates, byte[] attribValue, TxTableState state) throws IOException { byte[] regionStartKey = this.regionStartKey; byte[] regionEndKey = this.regionEndKey; if (services != null && indexMetaData.hasLocalIndexes()) { try { HRegionLocation tableRegionLocation = services.getTableRegionLocation(tableName, state.getCurrentRowKey()); regionStartKey = tableRegionLocation.getRegionInfo().getStartKey(); regionEndKey = tableRegionLocation.getRegionInfo().getEndKey(); } catch (SQLException e) { throw new IOException(e); } } Iterable<IndexUpdate> deletes = codec.getIndexDeletes(state, indexMetaData, regionStartKey, regionEndKey); for (IndexUpdate delete : deletes) { if (delete.isValid()) { delete.getUpdate().setAttribute(PhoenixTransactionContext.TX_ROLLBACK_ATTRIBUTE_KEY, attribValue); indexUpdates.add(new Pair<Mutation, byte[]>(delete.getUpdate(),delete.getTableName())); } } }
private boolean generatePuts( PhoenixIndexMetaData indexMetaData, Collection<Pair<Mutation, byte[]>> indexUpdates, TxTableState state) throws IOException { state.applyMutation(); byte[] regionStartKey = this.regionStartKey; byte[] regionEndKey = this.regionEndKey; if (services != null && indexMetaData.hasLocalIndexes()) { try { HRegionLocation tableRegionLocation = services.getTableRegionLocation(tableName, state.getCurrentRowKey()); regionStartKey = tableRegionLocation.getRegionInfo().getStartKey(); regionEndKey = tableRegionLocation.getRegionInfo().getEndKey(); } catch (SQLException e) { throw new IOException(e); } } Iterable<IndexUpdate> puts = codec.getIndexUpserts(state, indexMetaData, regionStartKey, regionEndKey); boolean validPut = false; for (IndexUpdate put : puts) { if (put.isValid()) { indexUpdates.add(new Pair<Mutation, byte[]>(put.getUpdate(),put.getTableName())); validPut = true; } } return validPut; }
Delete remove = (Delete)d.getUpdate(); remove.setTimestamp(ts); updateMap.addIndexUpdate(d.getTableName(), remove);
Mutation mutation = update.getUpdate(); updateMap.addIndexUpdate(table, mutation);
Delete remove = (Delete)d.getUpdate(); remove.setTimestamp(ts); updateMap.addIndexUpdate(d.getTableName(), remove);
Mutation mutation = update.getUpdate(); updateMap.addIndexUpdate(table, mutation);