You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by "bhabegger (via GitHub)" <gi...@apache.org> on 2026/06/08 13:11:06 UTC
[PR] OAK-12244: index nodes that gain a mixin rule, delete stale docs when… [jackrabbit-oak]
bhabegger opened a new pull request, #2938:
URL: https://github.com/apache/jackrabbit-oak/pull/2938
… mixin rule is lost
When an existing node's applicable indexing rule changes at runtime (e.g. jcr:mixinTypes added or removed), FulltextIndexEditor did not update the index because propertiesChanged was never set — jcr:mixinTypes is not normally listed in a rule's property definitions.
Track wasIndexable (rule matched before) alongside isIndexable() (rule matches after). In leave(), act on transitions:
- !wasIndexable && isIndexable(): node gained a rule → addOrUpdate
- wasIndexable && !isIndexable(): node lost a rule → deleteDocuments
Tests added:
- PropertyIndexCommonTest: two end-to-end integration tests (all backends)
- LuceneIndexEditor2Test: two unit tests verifying writer.docs / writer.deletedPaths
--
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: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-12244: Adding/removing mixin type not reflected in index [jackrabbit-oak]
Posted by "bhabegger (via GitHub)" <gi...@apache.org>.
bhabegger commented on code in PR #2938:
URL: https://github.com/apache/jackrabbit-oak/pull/2938#discussion_r3379615557
##########
oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/editor/FulltextIndexEditor.java:
##########
@@ -158,6 +164,19 @@ public void leave(NodeState before, NodeState after)
}
}
+ if (wasIndexable && !isIndexable()) {
Review Comment:
Normally, here, we are working at commit level not at individual change level.
So, if, in the code a mixin type was added to node A and then A was removed. We would not see the first operation as the `after` NodeState would be null. So we should be fine.
However, your proposal could make the code easier to read ;) So, let me see if we can adjust that.
--
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: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-12244: Adding/removing mixin type not reflected in index [jackrabbit-oak]
Posted by "thomasmueller (via GitHub)" <gi...@apache.org>.
thomasmueller commented on code in PR #2938:
URL: https://github.com/apache/jackrabbit-oak/pull/2938#discussion_r3378819738
##########
oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/editor/FulltextIndexEditor.java:
##########
@@ -158,6 +164,19 @@ public void leave(NodeState before, NodeState after)
}
}
+ if (wasIndexable && !isIndexable()) {
Review Comment:
I _think_ there might be some edge case where a node was changed (first triggering an update), _and_ at the same time the mixin was changed so it is deleted. I don't know if there is a test case for this, and if this would fail.
To cover this case, I think it would be better to use a "staged" logic:
toBeAdded = ... || ... || ... || ...
toBeDeleted = ... || ... || ... || ...
toBeUpdated = ... || ... || ... || ...
if (toBeDeleted) {
// delete logic
} else if (toBeAdded) {
// add logic
} else if (toBeUpdated) {
// update logic
}
--
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: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-12244: Adding/removing mixin type not reflected in index [jackrabbit-oak]
Posted by "bhabegger (via GitHub)" <gi...@apache.org>.
bhabegger commented on PR #2938:
URL: https://github.com/apache/jackrabbit-oak/pull/2938#issuecomment-4659652332
[AI] Added feature toggle `FT_OAK-12244` (kill switch `FT_OAK_12244_DISABLE`, default `false`) following the same pattern as `FT_OAK-12193`:
- **`FulltextIndexEditor`**: declares the toggle name and `AtomicBoolean` kill switch; the mixin-transition logic in `leave()` is now guarded by `!FT_OAK_12244_DISABLE.get()`; when disabled, pre-OAK-12244 behavior is used.
- **`LuceneIndexProviderService`**: registers the toggle with the OSGi whiteboard.
- **`LuceneIndexEditor2Test`**: two new tests verify that mixin-add and mixin-remove do **not** trigger index changes when the toggle is disabled.
--
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: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-12244: Adding/removing mixin type not reflected in index [jackrabbit-oak]
Posted by "bhabegger (via GitHub)" <gi...@apache.org>.
bhabegger commented on code in PR #2938:
URL: https://github.com/apache/jackrabbit-oak/pull/2938#discussion_r3380145004
##########
oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/editor/FulltextIndexEditor.java:
##########
@@ -158,6 +164,19 @@ public void leave(NodeState before, NodeState after)
}
}
+ if (wasIndexable && !isIndexable()) {
Review Comment:
[AI] Done — I've restructured `leave()` to use staged logic as suggested:
```java
boolean toBeDeleted = wasIndexable && !isIndexable();
boolean toBeAdded = !wasIndexable && isIndexable();
boolean toBeUpdated = wasIndexable && isIndexable() && propertiesChanged;
if (toBeDeleted) {
// deleteDocuments
} else if (toBeAdded || toBeUpdated) {
// addOrUpdate
}
```
The `else if` makes the mutual exclusivity explicit. I combined `toBeAdded` and `toBeUpdated` into a single branch since the action (`addOrUpdate`) is identical for both — the `before.exists()` flag already encodes the add-vs-update distinction passed into the writer.
All 1242 oak-lucene tests still pass.
--
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: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] OAK-12244: Adding/removing mixin type not reflected in index [jackrabbit-oak]
Posted by "thomasmueller (via GitHub)" <gi...@apache.org>.
thomasmueller merged PR #2938:
URL: https://github.com/apache/jackrabbit-oak/pull/2938
--
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: oak-dev-unsubscribe@jackrabbit.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org