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] [Commented] (OAK-5212) Avoid updating the index nodestate if no change is done in index
Date Mon, 05 Dec 2016 10:58:59 GMT

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

Chetan Mehrotra commented on OAK-5212:
--------------------------------------

Thought about using that but the javadocs indicated that it may result in false positive

{noformat}
  /**
   * Returns true if this index has deletions (including
   * buffered deletions).  Note that this will return true
   * if there are buffered Term/Query deletions, even if it
   * turns out those buffered deletions don't match any
   * documents.
   */
  public synchronized boolean hasDeletions() {
{noformat}

Per javadoc this means that it can have false positive and that too for delete which is the
case we addressing via this issue

{noformat}
  /** Returns true if there may be changes that have not been
   *  committed.  There are cases where this may return true
   *  when there are no actual "real" changes to the index,
   *  for example if you've deleted by Term or Query but
   *  that Term or Query does not match any documents.
   *  Also, if a merge kicked off as a result of flushing a
   *  new segment during {@link #commit}, or a concurrent
   *  merged finished, this method may return true right
   *  after you had just called {@link #commit}. */
  public final boolean hasUncommittedChanges() {
{noformat}

It would have been simpler if {{IndexWriter}} could have returned a boolean flag indicating
that it actually wrote something

> Avoid updating the index nodestate if no change is done in index
> ----------------------------------------------------------------
>
>                 Key: OAK-5212
>                 URL: https://issues.apache.org/jira/browse/OAK-5212
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: lucene
>            Reporter: Chetan Mehrotra
>            Assignee: Chetan Mehrotra
>            Priority: Minor
>              Labels: performance
>             Fix For: 1.6
>
>         Attachments: OAK-5212-v1.patch
>
>
> As noted in OAK-5211 directory listing was getting modified (due to reorder) even if
no change happens in index. 
> Another place where we update state post index close is at ":status" node where we store
{{lastUpdated}} and {{indexedNodes}} post index close. In normal cases LuceneIndexEditor avoids
initializing the IndexWriter if there is no change. However it can happen that when any node
gets deleted the editor performs a delete operation. It can happen that tree being deleted
is not indexed but still editor would do this as it cannot determine that easily. And in doing
that IndexWriter would be initialized.
> Currently IndexWriter being initialized is considered same as index updated. Due to this
index status nodes gets unnecessarily updated even if there is no change in index which causes
the IndexTracker to reopen the index even when it has not changed. 
> We should make this more explicit and find a way to determine if index has been updated
or not



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

Mime
View raw message