phoenix-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [phoenix] kadirozde commented on a change in pull request #469: PHOENIX-5156 Consistent Global Indexes for Non-Transactional Tables
Date Thu, 25 Apr 2019 19:35:44 GMT
kadirozde 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_r278700248
 
 

 ##########
 File path: phoenix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java
 ##########
 @@ -509,28 +438,104 @@ 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 = null;
+                  Iterator<IndexMaintainer> maintainerIterator = maintainers.iterator();
+                  while (maintainerIterator.hasNext()) {
+                      IndexMaintainer maintainer = maintainerIterator.next();
+                      if (Bytes.compareTo(next.getSecond(), maintainer.getIndexTableName())
== 0) {
+                          indexMaintainer = maintainer;
+                          break;
+                      }
+                  }
+
+                  if (indexMaintainer == null) {
+                      throw new DoNotRetryIOException(
+                              "preBatchMutateWithExceptions: indexMaintainer is null " +
+                                      c.getEnvironment().getRegion().getRegionInfo().getTable().getNameAsString());
+                  }
+                  byte[] emptyCF = indexMaintainer.getEmptyKeyValueFamily().copyBytesIfNecessary();
+                  // add the VERIFIED cell
+                  Mutation m = next.getFirst();
+                  boolean rebuild = PhoenixIndexMetaData.isIndexRebuild(m.getAttributesMap());
+                  long ts = 0;
+                  //if (rebuild) {
+                      Iterator iterator = m.getFamilyCellMap().entrySet().iterator();
+                      while (iterator.hasNext()) {
 
 Review comment:
   Done

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message