Bug 34739 - Linked biblios should not be merged (updated) when changes to an authority don't change the authorized heading
Summary: Linked biblios should not be merged (updated) when changes to an authority do...
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: MARC Authority data support (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Janusz Kaczmarek
QA Contact: Testopia
URL:
Keywords:
: 38742 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-09-07 17:04 UTC by Nick Clemens (kidclamp)
Modified: 2024-12-18 19:04 UTC (History)
4 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 34739: Linked biblios should not be merged (updated) when changes to an authority don't change the authorized heading (5.45 KB, patch)
2024-12-18 18:41 UTC, Janusz Kaczmarek
Details | Diff | Splinter Review
Bug 34739: Unit tests (5.22 KB, patch)
2024-12-18 18:41 UTC, Janusz Kaczmarek
Details | Diff | Splinter Review
Bug 34739: Linked biblios should not be merged (updated) when changes to an authority don't change the authorized heading (5.50 KB, patch)
2024-12-18 19:04 UTC, Roman Dolny
Details | Diff | Splinter Review
Bug 34739: Unit tests (5.27 KB, patch)
2024-12-18 19:04 UTC, Roman Dolny
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2023-09-07 17:04:54 UTC
If an authority record is modified in any way, we trigger a merge to update all biblios using the authority.

This also happens if we merge a duplciate authority into one that is in use, all biblios already attached to the correct authority are updated.

If the heading or controlled indicators or thesaurus have changed, this makes sense, but if not, we are triggering many biblio modifications and reindexes that are not needed.

We also need to consider the case where a See-From is is added and IncludeSeeFromInSearches is enabled
Comment 1 Marcel de Rooy 2023-09-11 06:35:31 UTC
There is a development about adding URIs from 024 in auth to bib record when merging. A Biblibre report, forgot the number. This would be an exception.
Comment 2 Phil Ringnalda 2023-09-12 20:40:19 UTC
Bug 22972
Comment 3 Janusz Kaczmarek 2024-12-18 18:41:04 UTC
Created attachment 175665 [details] [review]
Bug 34739: Linked biblios should not be merged (updated) when changes to an authority don't change the authorized heading

Currently, the function C4::AuthoritiesMarc::merge calls ModBiblio for
all bibliographic records linked to the modified authority record.  It
could seem a just behavior but we know that this could lead to
performance problems.  This is why AuthorityMergeLimit
systempreference with merge_authorities.pl was introduced (earlier:
dontmerge).

Although this partially solves the performance problems, for
moderately large and large catalogs (500+ K) and authority records
linked with a large number of bibliographic records, performance
problems still occur, even with overnight processing with
merge_authorities.pl.  This problem is particularly apparent when
updating authority records from central databases, whose modifications
are beyond our control.

It turns out, however, that many such modifications to authority
records involve fields other than the heading field (1XX in MARC 21),
so these updates in fact do not modify bibliographic records.
However, with the current merge function, every touch on an
authority record forces a call to the ModBiblio function.  The
number of relatively expensive ModBiblio calls could be
reduced by checking whether there has been an actual change in
the field associated with the authority record.

However, with IncludeSeeFromInSearches or IncludeSeeAlsoFromInSearches
preferences enabled, the record should be refreshed in the search
engine just in case (should the 4XX, 5XX fields have changed, which we
don't know at this point).

Test plan:
==========
1. Make sure to have CataloguingLog set to Log and
   IncludeSeeFromInSearches set to Include.
2. Have a bibliographic record with an authority record linked. Open
   the authority record in a separate tab, open it in the editor and
   save, without modifying it. Repeat this 2-3 times. In the
   bibliographic record tab open the Modification log and see a number of
   entries - for each “empty” modification of the linked authority
   record.
3. Apply the patch ; restart_all.
4. Repat p. 2. Note that there are no new entries in the log.
5. Edit the authority record again, this time putting in one of the
   proper 4XX $a subfield an uncommon word (but do not  touch the 1XX
   field). Save the authority record. In the bibliographic record
   tab control that there are no new entries in the modification log.
   Make a search for the word put in 4XX field. You should get the
   bibliographic record(s) linked to the edited authority record, even
   though the bibliographic record itself has not been modified.
6. Edit the authority record again, this time changing the 1XX field.
   Save the authority record. In the bibliographic record tab control
   that there are is new entry in the modification log.

Sponsored-by: Ignatianum University in Cracow
Comment 4 Janusz Kaczmarek 2024-12-18 18:41:07 UTC
Created attachment 175666 [details] [review]
Bug 34739: Unit tests

BTW, there is a tiny adjustment to one of the previous subtests to
fit to the modified merge behaviour.
Comment 5 Janusz Kaczmarek 2024-12-18 18:42:26 UTC
*** Bug 38742 has been marked as a duplicate of this bug. ***
Comment 6 Roman Dolny 2024-12-18 19:04:46 UTC
Created attachment 175667 [details] [review]
Bug 34739: Linked biblios should not be merged (updated) when changes to an authority don't change the authorized heading

Currently, the function C4::AuthoritiesMarc::merge calls ModBiblio for
all bibliographic records linked to the modified authority record.  It
could seem a just behavior but we know that this could lead to
performance problems.  This is why AuthorityMergeLimit
systempreference with merge_authorities.pl was introduced (earlier:
dontmerge).

Although this partially solves the performance problems, for
moderately large and large catalogs (500+ K) and authority records
linked with a large number of bibliographic records, performance
problems still occur, even with overnight processing with
merge_authorities.pl.  This problem is particularly apparent when
updating authority records from central databases, whose modifications
are beyond our control.

It turns out, however, that many such modifications to authority
records involve fields other than the heading field (1XX in MARC 21),
so these updates in fact do not modify bibliographic records.
However, with the current merge function, every touch on an
authority record forces a call to the ModBiblio function.  The
number of relatively expensive ModBiblio calls could be
reduced by checking whether there has been an actual change in
the field associated with the authority record.

However, with IncludeSeeFromInSearches or IncludeSeeAlsoFromInSearches
preferences enabled, the record should be refreshed in the search
engine just in case (should the 4XX, 5XX fields have changed, which we
don't know at this point).

Test plan:
==========
1. Make sure to have CataloguingLog set to Log and
   IncludeSeeFromInSearches set to Include.
2. Have a bibliographic record with an authority record linked. Open
   the authority record in a separate tab, open it in the editor and
   save, without modifying it. Repeat this 2-3 times. In the
   bibliographic record tab open the Modification log and see a number of
   entries - for each “empty” modification of the linked authority
   record.
3. Apply the patch ; restart_all.
4. Repat p. 2. Note that there are no new entries in the log.
5. Edit the authority record again, this time putting in one of the
   proper 4XX $a subfield an uncommon word (but do not  touch the 1XX
   field). Save the authority record. In the bibliographic record
   tab control that there are no new entries in the modification log.
   Make a search for the word put in 4XX field. You should get the
   bibliographic record(s) linked to the edited authority record, even
   though the bibliographic record itself has not been modified.
6. Edit the authority record again, this time changing the 1XX field.
   Save the authority record. In the bibliographic record tab control
   that there are is new entry in the modification log.

Sponsored-by: Ignatianum University in Cracow
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Comment 7 Roman Dolny 2024-12-18 19:04:49 UTC
Created attachment 175668 [details] [review]
Bug 34739: Unit tests

BTW, there is a tiny adjustment to one of the previous subtests to
fit to the modified merge behaviour.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>