@Override public void setup(RegionCoprocessorEnvironment env) throws IOException { this.env = env; // setup the phoenix codec. Generally, this will just be in standard one, but abstracting here // so we can use it later when generalizing covered indexes Configuration conf = env.getConfiguration(); Class<? extends IndexCodec> codecClass = conf.getClass(CODEC_CLASS_NAME_KEY, null, IndexCodec.class); try { Constructor<? extends IndexCodec> meth = codecClass.getDeclaredConstructor(new Class[0]); meth.setAccessible(true); this.codec = meth.newInstance(); this.codec.initialize(conf, env.getRegion().getRegionInfo().getTable().getName()); } catch (Exception e) { throw new IOException(e); } }
/** * By default, we always attempt to index the mutation. Commonly this can be slow (because the framework spends the * time to do the indexing, only to realize that you don't need it) or not ideal (if you want to turn on/off * indexing on a table without completely reloading it). * * @throws IOException */ @Override public boolean isEnabled(Mutation m) throws IOException { // ask the codec to see if we should even attempt indexing return this.codec.isEnabled(m); }
private void ensureNoUpdatesWhenCoveredByDelete(RegionCoprocessorEnvironment env, IndexCodec codec, List<Cell> currentState, Delete d) throws IOException { LocalHBaseState table = new SimpleTableState(Result.create(currentState)); LocalTableState state = new LocalTableState(table, d); state.setCurrentTimestamp(d.getTimeStamp()); // now we shouldn't see anything when getting the index update state.addPendingUpdates(d.getFamilyCellMap().get(FAMILY)); Iterable<IndexUpdate> updates = codec.getIndexUpserts(state, IndexMetaData.NULL_INDEX_META_DATA, null, null); for (IndexUpdate update : updates) { assertFalse("Had some index updates, though it should have been covered by the delete", update.isValid()); } } }
Iterable<IndexUpdate> cleanup = codec.getIndexDeletes(state, indexMetaData, env.getRegionInfo().getStartKey(), env.getRegionInfo().getEndKey()); if (cleanup != null) { for (IndexUpdate d : cleanup) {
Iterable<IndexUpdate> upserts = codec.getIndexUpserts(state, indexMetaData, env.getRegionInfo().getStartKey(), env.getRegionInfo().getEndKey()); state.resetTrackedColumns();
Iterable<IndexUpdate> cleanup = codec.getIndexDeletes(state, indexMetaData); if (cleanup != null) { for (IndexUpdate d : cleanup) {
Iterable<IndexUpdate> upserts = codec.getIndexUpserts(state, indexMetaData); state.resetTrackedColumns();
/** * By default, we always attempt to index the mutation. Commonly this can be slow (because the framework spends the * time to do the indexing, only to realize that you don't need it) or not ideal (if you want to turn on/off * indexing on a table without completely reloading it). * * @throws IOException */ @Override public boolean isEnabled(Mutation m) throws IOException { // ask the codec to see if we should even attempt indexing return this.codec.isEnabled(m); }
@Override public void setup(RegionCoprocessorEnvironment env) throws IOException { this.env = env; // setup the phoenix codec. Generally, this will just be in standard one, but abstracting here // so we can use it later when generalizing covered indexes Configuration conf = env.getConfiguration(); Class<? extends IndexCodec> codecClass = conf.getClass(CODEC_CLASS_NAME_KEY, null, IndexCodec.class); try { Constructor<? extends IndexCodec> meth = codecClass.getDeclaredConstructor(new Class[0]); meth.setAccessible(true); this.codec = meth.newInstance(); this.codec.initialize(conf, env.getRegion().getRegionInfo().getTable().getName()); } catch (Exception e) { throw new IOException(e); } }
Iterable<IndexUpdate> cleanup = codec.getIndexDeletes(state, indexMetaData, env.getRegionInfo().getStartKey(), env.getRegionInfo().getEndKey()); if (cleanup != null) { for (IndexUpdate d : cleanup) {
Iterable<IndexUpdate> upserts = codec.getIndexUpserts(state, indexMetaData, env.getRegionInfo().getStartKey(), env.getRegionInfo().getEndKey()); state.resetTrackedColumns();
/** * By default, we always attempt to index the mutation. Commonly this can be slow (because the framework spends the * time to do the indexing, only to realize that you don't need it) or not ideal (if you want to turn on/off * indexing on a table without completely reloading it). * * @throws IOException */ @Override public boolean isEnabled(Mutation m) throws IOException { // ask the codec to see if we should even attempt indexing return this.codec.isEnabled(m); }
@Override public void setup(RegionCoprocessorEnvironment env) throws IOException { this.env = env; // setup the phoenix codec. Generally, this will just be in standard one, but abstracting here // so we can use it later when generalizing covered indexes Configuration conf = env.getConfiguration(); Class<? extends IndexCodec> codecClass = conf.getClass(CODEC_CLASS_NAME_KEY, null, IndexCodec.class); try { Constructor<? extends IndexCodec> meth = codecClass.getDeclaredConstructor(new Class[0]); meth.setAccessible(true); this.codec = meth.newInstance(); this.codec.initialize(conf, env.getRegionInfo().getStartKey(), env.getRegionInfo().getEndKey(), env.getRegion().getRegionInfo().getTable().getName()); } catch (Exception e) { throw new IOException(e); } }