jackrabbit-oak-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chetan Mehrotra (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (OAK-4400) Correlate index with the index definition used to build it
Date Tue, 06 Dec 2016 14:59:58 GMT

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

Chetan Mehrotra updated OAK-4400:
---------------------------------
    Attachment: OAK-4400-v1.diff

Work done in feature branch at https://github.com/chetanmeh/jackrabbit-oak/compare/trunk...chetanmeh:OAK-4400

Also attached as [diff|^OAK-4400-v1.diff]

h3. Implementation Details

Upon reindex (or first index) the current NodeState representation of the index definition
node [1] would be stored under {{:index-definition}} like e.g. /oak:index/fooLuceneIndex/:index-definition.


Later when query needs to be performed the IndexDefinition instance would check if this node
is present. If yes then it would be used instead of current nodestate at index path i.e. nodestate
tree used would be  /oak:index/fooLuceneIndex/:index-definition instead of  /oak:index/fooLuceneIndex.


This ensures that all queries use index definition which was used in reindexing or creating
fresh index. if a user makes any change and does not reindex then those changes would not
be picked up

h4. Refresh stored index definition

In case if some trivial changes are made which does not require reindex. Like modifying exludedPaths
etc then that can be done by setting {{refresh}} property to {{true}} in index definition.
On next async indexing cycle this flag would be pickedup and stored index definition would
be refreshed. Post this the flag would be automatically removed and a log message would be
logged

{noformat}
LuceneIndexEditorContext - Refreshed the index definition for [/oak:index/fooLuceneIndex]

{noformat}

h4. JMX Access

To simplify troubleshooting the stored index definition can be accessed from {{LuceneIndex}}
MBean via {{getStoredIndexDefinition}} operation. It would dump the string representation
of stored NodeState

{noformat}
/{jcr:primaryType = oak:QueryIndexDefinition, compatVersion = 2, :version = 2, indexPath =
/oak:index/fooLuceneIndex, foo = bar, name = workflow, type = lucene, async = async, evaluatePathRestrictions
= false, :indexPath = /oak:index/fooLuceneIndex, refresh = true, reindex = false, reindexCount
= 1}
    indexRules{jcr:primaryType = nt:unstructured, :childOrder = [granite:InboxItem, cq:Workflow]}
      app:InboxItem{jcr:primaryType = nt:unstructured, :childOrder = [properties]}
        properties{jcr:primaryType = nt:unstructured, :childOrder = [startTime, assignee,
status]}
          startTime{jcr:primaryType = nt:unstructured, ordered = true, propertyIndex = true,
name = startTime, type = Date}
          assignee{jcr:primaryType = nt:unstructured, ordered = false, propertyIndex = true,
name = assignee, type = String}
          status{jcr:primaryType = nt:unstructured, ordered = false, propertyIndex = true,
name = status, type = String}
      app:Workflow{jcr:primaryType = nt:unstructured, :childOrder = [properties]}
        properties{jcr:primaryType = nt:unstructured, :childOrder = [startTime, endTime, status]}
          startTime{jcr:primaryType = nt:unstructured, ordered = true, propertyIndex = true,
name = startTime, type = Date}
          endTime{jcr:primaryType = nt:unstructured, ordered = true, propertyIndex = true,
name = endTime, type = Date}
          status{jcr:primaryType = nt:unstructured, ordered = false, propertyIndex = true,
name = status, type = String}

{noformat}

h4. Feature flag

This feature can be disabled by setting system property {{oak.lucene.disableStoredIndexDefinition}}
to {{true}}

[1] Only the visible part. Hidden tree would be excluded

> Correlate index with the index definition used to build it
> ----------------------------------------------------------
>
>                 Key: OAK-4400
>                 URL: https://issues.apache.org/jira/browse/OAK-4400
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: lucene, query
>    Affects Versions: 1.4
>            Reporter: Valentin Olteanu
>            Assignee: Chetan Mehrotra
>             Fix For: 1.6
>
>         Attachments: OAK-4400-v1.diff
>
>
> Currently, if the definition of an index is changed without reindexing, it will get in
an "inconsistent" state. 
> Of course, the reindexing is usually necessary, but it would be useful to know with which
definition the index was built. This could increase the visibility of the indexing state and
help debugging issues related to it.
> Some questions this improvement should respond to:
> # What is the definition of the index when the (re)indexing was triggered?
> # Are there any changes in the definition since the trigger? Which?
> I can imagine a solution built by "versioning" the definition nodes (oak:QueryIndexDefinition).
When the reindex is triggered, a new version of the node is created and the indexer stores
a reference to it.
> This would also allow the indexer to keep using the same definition until a new reindex,
even if changes are made meanwhile (i.e. use a fixed version instead of the latest definition).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message