Sorting by publication date is broken for migrated records

Bug #920134 reported by Dan Scott
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Status tracked in Main
2.1
Fix Released
High
Unassigned
Main
Fix Released
High
Unassigned

Bug Description

* Evergreen 2.1

The 2.0-2.1 upgrade script doesn't create the "pubdate" attribute in the attrs HSTORE column that is used by "sort by publication date" in the OPAC, leading to inconsistent results when new records are imported or migrated records are edited and thus reingested.

As a quick fix, we ran the following SQL statement over our database, which updated 1.7 million rows in a few minutes:

UPDATE metabib.record_attr
    SET attrs = attrs || ('pubdate' => (attrs->'date1'))
   WHERE defined(attrs, 'pubdate') IS FALSE
   AND defined(attrs, 'date1') IS TRUE;

Tags: pullrequest
Dan Scott (denials)
Changed in evergreen:
milestone: none → 2.1.2
Revision history for this message
Dan Scott (denials) wrote :

Pushed user/dbs/fix_pubdate_sort_migrated_recs with updates to the 2.0-2.1 and adding a 2.1.1-2.1.2 version upgrade script to working repo for master; these should be backported to rel_2_1. (Aside, maybe we should adopt the version_upgrade directory in rel_2_1 as well, as it's bizarre not to have the 2.1.0-2.1.1 upgrade script in rel_2_1 as is currently the case).

Didn't do it via the upgrade_db approach because it only affects migrated records, not the base schema. Maybe that's wrong, but it doesn't make much sense to me to increment the upgrade_log number for something that doesn't matter in the least to people creating new database schemas.

tags: added: pullrequest
Revision history for this message
Michael Peters (mrpeters) wrote :

Evergreen Indiana applied this fix on 1/25 with good results. Took about 20 minutes for our approximately 3 million bibs.

Signoff
http://git.evergreen-ils.org/?p=working/Evergreen.git;a=commitdiff;h=ce99a992b57f2280daabc35269297cade5a5fd55

Revision history for this message
Dan Scott (denials) wrote :

Thanks, Michael, but the commit is not really signed off in your user/mrpeters-isl/fix_pubdate_sort_migrated_recs-signoff branch; it should show "Signed-off-by: Michael Peters <email address hidden>".

Generally you would do that via "git cherry-pick -s <commithash>" when you're picking my commit into your branch; the "-s" automatically adds your sign-off to the commit message. Anyway, given that you've tested it and found it good, I'll go ahead and add your sign-off manually and push to master and rel_2_1.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.