Bug 9050

Summary: rebuild_zebra should use the adelete action so it doesn't fail when deleting a record not in the index
Product: Koha Reporter: Jared Camins-Esakov <jcamins>
Component: SearchingAssignee: Galen Charlton <gmcharlt>
Status: CLOSED FIXED QA Contact: Paul Poulain <paul.poulain>
Severity: major    
Priority: P5 - low CC: chris, jcamins, paul.poulain
Version: 3.8   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 9050: Use safer adelete when deleting records from Zebra index
Bug 9050: Use safer adelete when deleting records from Zebra index

Description Jared Camins-Esakov 2012-11-10 03:04:10 UTC
From the man page of zebraidx:
       delete directory
           Remove the records corresponding to the files found under directory from the register.

       adelete directory
           Remove the records corresponding to the files found under directory from the register. Unlike command delete this command does not fail if a record does
           not exist (but which is attempted deleted).
Comment 1 Jared Camins-Esakov 2012-11-10 13:46:07 UTC Comment hidden (obsolete)
Comment 2 Chris Cormack 2012-11-11 07:42:11 UTC
Created attachment 13381 [details] [review]
Bug 9050: Use safer adelete when deleting records from Zebra index

Previously we used the "delete" command in zebraidx, which fails when
you try to delete a record that doesn't exist in the index. By changing
to the "adelete" command, we can reduce the likelihood of a failed
delete causing ghost records. A symptom of this problem is the warning
message occasionally encountered when indexing from the zebraqueue,
"[warn] cannot delete record above (seems new)."

To test:
1) Add a recordDelete action for a record that does not exist to
   zebraqueue in MySQL:
   INSERT INTO zebraqueue (biblio_auth_number, operation, server) \
       VALUES (999999999, 'recordDelete', 'biblioserver');
2) Run `rebuild_zebra.pl -b -z -v [-x]`.
3) Note that you do not get the message "[warn] cannot delete record
   above (seems new)".

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Comment 3 Paul Poulain 2012-11-12 17:21:48 UTC
QA comment
 * tiny (one char) patch that fixes an uncommon problem, worth being fixed.

passed QA

(not sure it's a major problem though, if there's not other effect than the warning, it's a minor one. Not changing severity, but if someone agree with me, feel free !)
Comment 4 Jared Camins-Esakov 2012-11-12 17:33:54 UTC
(In reply to comment #3)
> QA comment
>  * tiny (one char) patch that fixes an uncommon problem, worth being fixed.
> 
> passed QA
> 
> (not sure it's a major problem though, if there's not other effect than the
> warning, it's a minor one. Not changing severity, but if someone agree with
> me, feel free !)

Definitely a major problem. The warning is only a symptom. The reason it's a problem is that nothing is processed after that warning but the entries are still marked as done in zebraqueue.
Comment 5 Jared Camins-Esakov 2012-11-12 23:54:37 UTC
This patch has been pushed to master.
Comment 6 Paul Poulain 2012-11-16 17:33:14 UTC
Patch pushed to branch 3.10.x
Comment 7 Chris Cormack 2013-04-22 10:17:09 UTC
Pushed to 3.8.x will be in 3.8.12