gokceni commented on a change in pull request #469: PHOENIX-5156 Consistent
Global Indexes for Non-Transactional Tables
URL: https://github.com/apache/phoenix/pull/469#discussion_r269296835
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java
##########
@@ -509,28 +467,79 @@ public void
preBatchMutateWithExceptions(ObserverContext<RegionCoprocessorEnviro
byte[] tableName =
c.getEnvironment().getRegion().getTableDescriptor().getTableName().getName();
Iterator<Pair<Mutation, byte[]>> indexUpdatesItr =
indexUpdates.iterator();
List<Mutation> localUpdates = new
ArrayList<Mutation>(indexUpdates.size());
+ List<Pair<Mutation, byte[]>> postIndexUpdates = new
ArrayList<>(indexUpdates.size());
+ List<Pair<Mutation, byte[]>> indexUpdatesForDeletes = new
ArrayList<>(indexUpdates.size());
+ IndexMetaData indexMetaData =
this.builder.getIndexMetaData(miniBatchOp);
+ if (!(indexMetaData instanceof PhoenixIndexMetaData)) {
+ throw new DoNotRetryIOException(
+ "preBatchMutateWithExceptions: indexMetaData is not an
instance of PhoenixIndexMetaData " +
+
c.getEnvironment().getRegion().getRegionInfo().getTable().getNameAsString());
+ }
+ List<IndexMaintainer> maintainers =
((PhoenixIndexMetaData)indexMetaData).getIndexMaintainers();
while(indexUpdatesItr.hasNext()) {
Pair<Mutation, byte[]> next = indexUpdatesItr.next();
if (Bytes.compareTo(next.getSecond(), tableName) == 0) {
localUpdates.add(next.getFirst());
indexUpdatesItr.remove();
}
+ else {
+ // get index maintainer for this index table
+ IndexMaintainer indexMaintainer =
getIndexMaintainer(maintainers, next.getSecond());
+ if (indexMaintainer == null) {
+ throw new DoNotRetryIOException(
+ "preBatchMutateWithExceptions: indexMaintainer
is null " +
+
c.getEnvironment().getRegion().getRegionInfo().getTable().getNameAsString());
+ }
+ byte[] emptyCF =
indexMaintainer.getEmptyKeyValueFamily().copyBytesIfNecessary();
+ byte[] emptyCQ = indexMaintainer.getEmptyKeyValueQualifier();
+ // add the VERIFIED cell
+ Mutation m = next.getFirst();
+ boolean rebuild =
PhoenixIndexMetaData.isIndexRebuild(m.getAttributesMap());
+ long ts = getMaxTimestamp(m);
+ if (rebuild) {
+ if (m instanceof Put) {
+ ((Put)m).addColumn(emptyCF, emptyCQ, ts, TRUE_BYTES);
+ }
+ } else {
+ if (m instanceof Put) {
+ ((Put)m).addColumn(emptyCF, emptyCQ, ts,
FALSE_BYTES);
+ Put put = new Put(m.getRow());
+ put.addColumn(emptyCF, emptyCQ, ts, TRUE_BYTES);
Review comment:
Should not this be FALSE_BYTES since rebuild is false?
----------------------------------------------------------------
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