[ 
https://issues.apache.org/jira/browse/SLING-13387?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18150819#comment-18150819
 ] 

Julian Reschke commented on SLING-13387:
----------------------------------------

OK,

AFAIU:

# We need to update the Oak dependency to 2.8.0 (obviously).
# We need to add an index definition that Oak can process on startup. (new 
resource resolver index)
# That index better works for both Aliases and VanityPaths.
# Add a fallback to safe code (system property), but what version should we 
fall back to? (old PagedQuery fails for certain scenarios, but non-paged 
processing will fail for everybody with more hits than the configured query 
limit)
# We need to modify the query to use the new index. (tag?)
# And the what's the strategy when the new index does not yet exist?




> Paged query for aliases fails due to stale alias index and shifting 
> sling:alias values
> --------------------------------------------------------------------------------------
>
>                 Key: SLING-13387
>                 URL: https://issues.apache.org/jira/browse/SLING-13387
>             Project: Sling
>          Issue Type: Bug
>          Components: ResourceResolver
>            Reporter: Julian Reschke
>            Assignee: Julian Reschke
>            Priority: Major
>
> (AI generated summary) 
> Alias resolution and querying rely heavily on the resource resolver's alias 
> index (Oak property/traversal index tracking {{{}sling:alias{}}}).
> When executing *paged queries* for aliases across a large content tree, 
> pagination relies on consistent sorting or offset keys. However, if the alias 
> index is stale or if the underlying "first" values of multi-valued or 
> dynamically changing {{sling:alias}} properties shift unexpectedly between 
> page fetches, the pagination mechanism breaks. This results in failed 
> queries, missing results, or inconsistent data sets being returned.
> h3. Steps to Reproduce
>  # Set up an environment with a significant volume of resources containing 
> {{sling:alias}} properties.
>  # Trigger a background content update or frequent creations/modifications 
> that actively alter {{sling:alias}} values.
>  # Execute a *paged query* (using limit/offset or cursor-based pagination) 
> targeting the alias index.
>  # Observe the query execution while the index is catching up or when the 
> sorting key ({{{}sling:alias{}}} first value) mutates between pages.
> h3. Actual Behavior
>  * Paged queries fail with query execution exceptions, or return 
> truncated/duplicated results.
>  * The Oak index logs warnings or errors regarding traversal/staleness.
>  * Pagination cursors become invalid because the underlying index order 
> shifted mid-pagination due to changing property values.
> h3. Expected Behavior
>  * Paged alias queries should remain resilient against minor index staleness 
> or handle shifting property values gracefully.
>  * Robust error handling or alternative fallback sorting mechanisms should 
> prevent total query failures when index states are inconsistent.
> h3. Technical Notes / Root Cause
>  * *Index Staleness:* Oak async indexes take time to re-index, leading to a 
> window where queries return stale or shifting pointers.
>  * *Unstable Sorting Keys:* Multi-valued {{sling:alias}} properties or 
> frequent updates change the lexical "first" value used for ordering, breaking 
> standard offset/limit pagination assumptions.
>  * *Possible Mitigations:* Investigate implementing deterministic sorting 
> (e.g., combining with jcr:uuid or path as a secondary sort criterion) or 
> improving index configuration parameters for {{{}sling:alias{}}}.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to