You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Thomas Mueller (JIRA)" <ji...@apache.org> on 2019/06/06 14:09:00 UTC

[jira] [Resolved] (OAK-8343) Allow queries to be delayed until an index is available

     [ https://issues.apache.org/jira/browse/OAK-8343?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Mueller resolved OAK-8343.
---------------------------------
    Resolution: Won't Fix

Even thought a patch is available, I will not commit it and close the issue. Reason: It turned out there are queries running before async indexing is run. It's quite hard to ensure that won't happen. An alternative solution is to create a temporary index (a property index) that will ensure each query can use an index. This temporary index can then be auto-disabled (using the "supersedes" flag, OAK-6820), and then eventually removed.

> Allow queries to be delayed until an index is available
> -------------------------------------------------------
>
>                 Key: OAK-8343
>                 URL: https://issues.apache.org/jira/browse/OAK-8343
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: lucene, query
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>            Priority: Major
>         Attachments: OAK-8343-b.patch, OAK-8343.patch
>
>
> Currently, indexes are built asynchronously. That is, if an index definition is added, the index is eventually built, but it's quite hard to say when it is ready for queries. This can be specially a problem right after the initial repository initialization, or after an upgrade.
> In theory, system startup could be delayed until all indexes are ready (e.g. set the "reindex" flag for important indexes, and at startup, wait until the "reindex" flag is set to "false"). However, doing that would block threads that _don't_ need an index. It would be better to only block threads that actually do run queries. That would make startup deterministic, without delaying other threads unnecessarily.
> To solve the problem, we can add a property "waitForIndex" in the index definition (just Lucene indexes is fine for now, as those are the important asynchronous ones). If set, then queries that potentially use those indexes are delayed, until the indexes are ready for sure. Reindex would need to remove that property (the same as it removes e.g. refresh or sets reindex to false). For added security, queries are only blocked as long as "reindex" is also set to true (this ensures that waitForIndex is removed eventually), and waiting should time out after 2 minutes, to ensure the feature doesn't block startup forever if indexing fails for some reason.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)