bhabegger commented on code in PR #3078:
URL: https://github.com/apache/jackrabbit-oak/pull/3078#discussion_r3813211141


##########
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/inventory/IndexDefinitionPrinter.java:
##########
@@ -69,6 +74,17 @@ public void print(PrintWriter printWriter, Format format, 
boolean isZip) {
                 NodeState idxState = NodeStateUtils.getNode(root, indexPath);
                 createSerializer(json).serialize(idxState);
             }
+            // The "diff" indexes (diff.index / diff.index.optimizer) are not 
oak:QueryIndexDefinition nodes, so they
+            // are not returned by the IndexPathService and would otherwise be 
missing from the output. Add them
+            // explicitly, rendering their diff.json payload as inline JSON so 
the pending diff is readable.
+            for (String name : new String[] {DiffIndexMerger.DIFF_INDEX, 
DiffIndexMerger.DIFF_INDEX_OPTIMIZER}) {

Review Comment:
   When I see this kind of "work around", it very often means there is a design 
flaw somewhere. It's likely not the issue of this PR, but something else (the 
complexity of this PR is a symptom). 
   
   Before `/oak:index/` contained a single type of object 
`oak:QueryIndexDefinition`. Now it can contain 2 types of objects 
`oak:QueryIndexDefinition` and these `diff.index` or `diff.index.optimizer` for 
those 2 it's not the type that is important but their name. 
   
   Before, printing was a natural walk through the tree outputting what ever 
was on it's path.
   
   Maybe we can make this "printing" a bit cleaner by splitting this method up:
   loop on the indexPathService.getIndexPaths() -> call a auxilary 
"printIndexDefinitionNode" mtehod for this path 
   
   Move the logic to determine which diffIndexPaths to the indexPathService 
(where we add a method .getDiffPaths())
   loop on those results and internally call an auxilary "printDiffNode" method 
(which is basically serializeDiffIndex, see my comments there).



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to