gjacoby126 commented on a change in pull request #625: PHOENIX-5565 Unify index
update structures in IndexRegionObserver and…
URL: https://github.com/apache/phoenix/pull/625#discussion_r345467399
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/hbase/index/builder/IndexBuildManager.java
##########
@@ -79,28 +82,20 @@ public IndexMetaData
getIndexMetaData(MiniBatchOperationInProgress<Mutation> min
return this.delegate.getIndexMetaData(miniBatchOp);
}
- public Collection<Pair<Pair<Mutation, byte[]>, byte[]>> getIndexUpdates(
+ public void getIndexUpdates(ListMultimap<HTableInterfaceReference,
Pair<Mutation, byte[]>> indexUpdates,
MiniBatchOperationInProgress<Mutation> miniBatchOp,
Collection<? extends Mutation> mutations,
IndexMetaData indexMetaData) throws Throwable {
// notify the delegate that we have started processing a batch
this.delegate.batchStarted(miniBatchOp, indexMetaData);
// Avoid the Object overhead of the executor when it's not actually
parallelizing anything.
- ArrayList<Pair<Pair<Mutation, byte[]>, byte[]>> results = new
ArrayList<>(mutations.size());
for (Mutation m : mutations) {
Collection<Pair<Mutation, byte[]>> updates = delegate.getIndexUpdate(m,
indexMetaData);
- if (PhoenixIndexMetaData.isIndexRebuild(m.getAttributesMap())) {
- for (Pair<Mutation, byte[]> update : updates) {
-
update.getFirst().setAttribute(BaseScannerRegionObserver.REPLAY_WRITES,
- BaseScannerRegionObserver.REPLAY_INDEX_REBUILD_WRITES);
- }
- }
for (Pair<Mutation, byte[]> update : updates) {
- results.add(new Pair<>(update, m.getRow()));
+ indexUpdates.put(new HTableInterfaceReference(new
ImmutableBytesPtr(update.getSecond())), new Pair<>(update.getFirst(),
m.getRow()));
Review comment:
nit: wouldn't it be more efficient to reuse HTableInterfaceReference rather
than create N of them when we're likely mutating only a small number of tables?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services