gjacoby126 commented on a change in pull request #978: URL: https://github.com/apache/phoenix/pull/978#discussion_r534405992
########## File path: phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionScanner.java ########## @@ -479,6 +486,8 @@ void deleteCForQ(Tuple result, List<Cell> results, UngroupedAggregateRegionObser delete.addColumns(deleteCF, deleteCQ, ts); // force tephra to ignore this deletes delete.setAttribute(PhoenixTransactionContext.TX_ROLLBACK_ATTRIBUTE_KEY, new byte[0]); + // TODO: should we set the source of operation attribute here. + // TODO: This will be true if we drop column or drop table Review comment: Good question, @shahrs87 . I think we should set the attribute there. ########## File path: phoenix-core/src/main/java/org/apache/phoenix/hbase/index/IndexRegionObserver.java ########## @@ -991,6 +1000,49 @@ public void preBatchMutateWithExceptions(ObserverContext<RegionCoprocessorEnviro } } + /** + * Set Cell Tags to delete markers with source of operation attribute. + * @param miniBatchOp + * @throws IOException + */ + private void setDeleteAttributes(MiniBatchOperationInProgress<Mutation> miniBatchOp) + throws IOException { + for (int i = 0; i < miniBatchOp.size(); i++) { + Mutation m = miniBatchOp.getOperation(i); + if (!(m instanceof Delete)) { + // Ignore if it is not Delete type. + continue; + } + byte[] sourceOpAttr = m.getAttribute(QueryServices.SOURCE_OPERATION_ATTRIB); + if (sourceOpAttr == null) { + continue; + } + + Tag sourceOpTag = new ArrayBackedTag(PhoenixTagType.SOURCE_OPERATION_TAG_TYPE, + sourceOpAttr); + List<Cell> updatedCells = new ArrayList<>(); + for (CellScanner cellScanner = m.cellScanner(); cellScanner.advance();) { + Cell cell = cellScanner.current(); + RawCell rawCell = (RawCell)cell; + List<Tag> tags = new ArrayList<>(); + Iterator<Tag> tagsIterator = rawCell.getTags(); + while (tagsIterator.hasNext()) { + tags.add(tagsIterator.next()); + } + tags.add(sourceOpTag); + // TODO: PrivateCellUtil's IA is Private. Need to change it to LP with IA.COPROC. Review comment: Can update the comment with a TODO pointing to the HBase JIRA introducing the new LP(COPROC) API you made. ---------------------------------------------------------------- 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: us...@infra.apache.org