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

Sally Ang updated LUCENE-5520:
------------------------------

    Attachment: working patch.patch
                TestBlockJoin.patch
                non working patch.patch

I've attached a patch for TestBlockJoin.java in file TestBlockJoin.patch
Without any modification it reproduces the error that happened on our 
application.

Attached is another patch for ToChildBlockJoinQuery.java that passes all the 
original test and my additional test 'working patch.patch'
What this patch did is just add another check so that if the parent doesn't 
have any child we continue to the next parent.
     if (acceptDocs != null && !acceptDocs.get(childDoc)) {
       if (childDoc < parentDoc) {
         continue nextChildDoc;
       } else {
         continue;
       }
     }

What I'm confused is with this other patch 'non working patch.patch', it passes 
all the test including my test except testRandom.
Here what I do is before checking for deleted childDoc I checked if the parent 
is deleted, if it is deleted we just go to the next parent.
            if (acceptDocs != null) {
         System.out.println("parent doc " + parentDoc + " is alive: " + 
acceptDocs.get(parentDoc));
              if (!acceptDocs.get(parentDoc)) {
                continue;
              }
            }

            childDoc = 1 + parentBits.prevSetBit(parentDoc-1);

            if (acceptDocs != null && !acceptDocs.get(childDoc)) {
              continue nextChildDoc;
            }

attached in 'testout.txt' is the output of testRandom
These lines show we have 6 deleted parents
[junit4:junit4]   1> DELETE parentID=40
[junit4:junit4]   1> DELETE parentID=49
[junit4:junit4]   1> DELETE parentID=54
[junit4:junit4]   1> DELETE parentID=77
[junit4:junit4]   1> DELETE parentID=102
[junit4:junit4]   1> DELETE parentID=104

But somehow there are more parent doc that has their acceptDocs bit set to 
false.
[junit4:junit4]   1> parent doc 29 is alive: false
[junit4:junit4]   1> parent doc 40 is alive: false
[junit4:junit4]   1> parent doc 56 is alive: false
[junit4:junit4]   1> parent doc 95 is alive: false
[junit4:junit4]   1> parent doc 99 is alive: false
[junit4:junit4]   1> parent doc 122 is alive: false
[junit4:junit4]   1> parent doc 141 is alive: false
[junit4:junit4]   1> parent doc 150 is alive: false
[junit4:junit4]   1> parent doc 2 is alive: false
[junit4:junit4]   1> parent doc 20 is alive: false
[junit4:junit4]   1> parent doc 38 is alive: false
[junit4:junit4]   1> parent doc 87 is alive: false
[junit4:junit4]   1> parent doc 43 is alive: false
[junit4:junit4]   1> parent doc 59 is alive: false
[junit4:junit4]   1> parent doc 78 is alive: false
[junit4:junit4]   1> parent doc 82 is alive: false

Is it right for me to assume acceptDocs.get(docId) return true if the docId is 
not deleted and false if it is deleted?
Can we use the first working patch?

> ArrayIndexOutOfBoundException in ToChildBlockJoinQuery when there's a deleted 
> parent without any children
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-5520
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5520
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: modules/join
>    Affects Versions: 4.2, 4.7
>            Reporter: Sally Ang
>         Attachments: TestBlockJoin.patch, non working patch.patch, 
> testout.txt, working patch.patch
>
>
> This problem is found in lucene 4.2.0 and reproduced in 4.7.0
> In our app when we delete a document we always delete all the children. 
> But not all parents have children. The exception happen for us when the 
> parent without children is deleted.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to