Index Errors while Upgrading Database from 3.8.8 to 4.4.2

Hello,

I’ve been toying around with upgrading RT 3.8.8 to 4.4.2 for a while now. I’ve got a new server with centos 7, apache 2.4.6, and mariaDB. While trying to follow best practices I installed a stand-alone perl version 5.26.1, which differs from the system version of v5.16.3.

Installing RT is flawless, but when migrating the 3.8.8 DB to the new server and running ‘make upgrade-database’ (from 3.8.8 to 4.4.2) I get hung up a in couple spots having to do with indexing. The first spot is during the 4.1.23 update:

Processing 4.1.23
Now inserting database indexes.
Couldn't finish 'upgrade' step.

ERROR: Couldn't execute 'etc/upgrade/4.1.23/indexes': Can't locate etc/upgrade/4.1.23/indexes in @INC (@INC contains: /opt/rt4/sbin/../local/lib /opt/rt4/local/plugins/RT-Extension-MergeUsers/lib /opt/rt4/sbin/../lib /opt/perl5/lib/site_perl/5.26.1/x86_64-linux /opt/perl5/lib/site_perl/5.26.1 /opt/perl5/lib/5.26.1/x86_64-linux /opt/perl5/lib/5.26.1) at /opt/rt4/sbin/../lib/RT/Handle.pm line 591.

If I run ‘make upgrade-database’ again starting at 4.1.23 to 4.4.2, it kicks off and migrates almost all the way through, but then I get another index error on 4.4.2:

run from 4.1.23 to 4.4.2

Processing 4.4.2
Now populating database schema.
Now inserting database indexes.
Couldn't finish 'upgrade' step.

ERROR: Couldn't execute 'etc/upgrade/4.4.2/indexes': Can't locate etc/upgrade/4.4.2/indexes in @INC (@INC contains: /opt/rt4/sbin/../local/lib /opt/rt4/sbin/../lib /opt/perl5/lib/site_perl/5.26.1/x86_64-linux /opt/perl5/lib/site_perl/5.26.1 /opt/perl5/lib/5.26.1/x86_64-linux /opt/perl5/lib/5.26.1) at /opt/rt4/sbin/../lib/RT/Handle.pm line 591.

Despite the errors, RT fires up and I can navigate around without errors. Haven’t tested more than that.

However, I have another test system running Centos 7, apache 2.4.6, and mariaDB, but this one doesn’t utilize a stand-alone perl and just uses a system version 5.16.3. When i run ‘make upgrade-database’ on here, it runs all the way through without any indexing errors. One warning while it finishes:

Processing 3.8.9
Now inserting data.
...............  
Processing 4.4.2
Now populating database schema.
Now inserting database indexes.
Now inserting data.
[4167] [Sun Nov 12 05:08:27 2017] [warning]: Unable to load scrip On TimeWorked Change Update User TimeWorked: Couldn't find row. If you renamed this scrip, you can manually disable it as it is no longer needed. (./etc/upgrade/4.4.2/content:66)
Done.

.
My questions are twofold. Why do I get these indexing errors when running ‘make upgrade-database’ with stand-alone perl v5.26.1, but not when using the system version 5.16.3? Is the last warning for the TimeWorked any big deal?

On a side note, no matter which perl I use I get the a couple warnings / errors like this below. I think it has to do with custom field categories changing over upgrades and they seem to work just fine despite the errors. Each custom field that utilized categories seems to have warnings / errors with like this. Can anyone confirm my thoughts that this isn’t anything to worry about?

[5520] [Sun Nov 12 04:52:03 2017] [warning]: Found CF 'Resolution Category' with categories: CPE, LAN, WAN, Misc (./etc/upgrade/4.3.6/content:25)
[5520] [Sun Nov 12 04:52:03 2017] [warning]: Going to create CF Resolution Category category for it (./etc/upgrade/4.3.6/content:27)
[5520] [Sun Nov 12 04:52:03 2017] [warning]: DBD::mysql::st execute failed: Unknown column 'UniqueValues' in 'field list' at /opt/perl5/lib/site_perl/5.26.1/DBIx/SearchBuilder/Handle.pm line 586. (/opt/perl5/lib/site_perl/5.26.1/DBIx/SearchBuilder/Handle.pm:586)
[5520] [Sun Nov 12 04:52:03 2017] [warning]: RT::Handle=HASH(0x5ccb778) couldn't execute the query 'INSERT INTO CustomFields (Description, ValuesClass, LookupType, Type, Disabled, MaxValues, LastUpdatedBy, Created, Name, LastUpdated, Creator, RenderType, BasedOn, Pattern, UniqueValues, CanonicalizeClass) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' at /opt/perl5/lib/site_perl/5.26.1/DBIx/SearchBuilder/Handle.pm line 599.
        DBIx::SearchBuilder::Handle::SimpleQuery(RT::Handle=HASH(0x5ccb778), "INSERT INTO CustomFields (Description, ValuesClass, LookupTyp"..., "", undef, "RT::Queue-RT::Ticket", "Select", 0, 1, ...) called at /opt/perl5/lib/site_perl/5.26.1/DBIx/SearchBuilder/Handle.pm line 352
        DBIx::SearchBuilder::Handle::Insert(RT::Handle=HASH(0x5ccb778), "CustomFields", "Description", "", "ValuesClass", undef, "LookupType", "RT::Queue-RT::Ticket", ...) called at /opt/perl5/lib/site_perl/5.26.1/DBIx/SearchBuilder/Handle/mysql.pm line 36
        DBIx::SearchBuilder::Handle::mysql::Insert(RT::Handle=HASH(0x5ccb778), "CustomFields", "Description", "", "ValuesClass", undef, "LookupType", "RT::Queue-RT::Ticket", ...) called at /opt/perl5/lib/site_perl/5.26.1/DBIx/SearchBuilder/Record.pm line 1320
        DBIx::SearchBuilder::Record::Create(RT::CustomField=HASH(0x5f0f378), "Description", "", "ValuesClass", undef, "LookupType", "RT::Queue-RT::Ticket", "Type", ...) called at /opt/rt4/sbin/../lib/RT/Record.pm line 316
        RT::Record::Create(RT::CustomField=HASH(0x5f0f378), "Name", "Resolution Category category", "Type", "Select", "RenderType", undef, "MaxValues", ...) called at /opt/rt4/sbin/../lib/RT/CustomField.pm line 366
        RT::CustomField::Create(RT::CustomField=HASH(0x5f0f378), "Name", "Resolution Category category", "Type", "Select", "MaxValues", 1, "LookupType", ...) called at ./etc/upgrade/4.3.6/content line 34
        RT::Handle::__ANON__() called at /opt/rt4/sbin/../lib/RT/Handle.pm line 925
        eval {...} called at /opt/rt4/sbin/../lib/RT/Handle.pm line 925
        RT::Handle::InsertData(RT::Handle=HASH(0x5ccb778), "./etc/upgrade/4.3.6/content", undef) called at /opt/rt4/sbin/rt-setup-database line 388
        main::__ANON__() called at /opt/rt4/sbin/rt-setup-database line 401
        main::action_insert("prompt-for-dba-password", 1, "backcompat", ARRAY(0x1b322a0), "datafile", undef, "datadir", "./etc/upgrade/4.3.6", ...) called at /opt/rt4/sbin/rt-setup-database line 569
        main::action_upgrade("prompt-for-dba-password", 1, "action", "upgrade", "package", "RT") called at /opt/rt4/sbin/rt-setup-database line 210 (/opt/perl5/lib/5.26.1/Carp.pm:170)
[5520] [Sun Nov 12 04:52:03 2017] [error]: Can't create custom field 'Resolution Category category': Internal Error: Couldn't execute the query 'INSERT INTO CustomFields (Description, ValuesClass, LookupType, Type, Disabled, MaxValues, LastUpdatedBy, Created, Name, LastUpdated, Creator, RenderType, BasedOn, Pattern, UniqueValues, CanonicalizeClass) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'Unknown column 'UniqueValues' in 'field list' (./etc/upgrade/4.3.6/content:105)

Thanks in advance,
Brian

I’m thinking it’s a Perl issue. Reading more into the error and looking rt-setup-database, Handle.pm, and version specific index files, it seems that @INC isn’t getting updated with the proper paths on my RT server with stand-alone Perl 5.26.1, while my RT server with system Perl 5.16.3 is.

Perl 5.26.1 @INC shows these paths:
@INC:
/opt/perl5/lib/site_perl/5.26.1/x86_64-linux
/opt/perl5/lib/site_perl/5.26.1
/opt/perl5/lib/5.26.1/x86_64-linux
/opt/perl5/lib/5.26.1

Perl 5.16.3 @INC shows these paths:
@INC:
/usr/local/lib64/perl5
/usr/local/share/perl5
/usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl
/usr/lib64/perl5
/usr/share/perl5

But the error (shown in previous post) for 5.26.1 shows these paths:
@INC contains:
/opt/rt4/sbin/…/local/lib
/opt/rt4/local/plugins/RT-Extension-MergeUsers/lib
/opt/rt4/sbin/…/lib
/opt/perl5/lib/site_perl/5.26.1/x86_64-linux
/opt/perl5/lib/site_perl/5.26.1
/opt/perl5/lib/5.26.1/x86_64-linux
/opt/perl5/lib/5.26.1
.
None of these paths include a path to etc/upgrade/4.4.2/indexes making me think that the proper path isn’t dynamically being added to @INC on 5.26.1 when it must be properly getting added to @INC in 5.16.3. Maybe something environmental or a silent error?

I’m pretty green when it comes to Perl, but I’ll try to debug some of this somehow to see what’s going wrong.

Any tips are appreciated!

I found a work around for this. I was mistaken in my previous post by saying that the error in the first post includes the . element in @INC on 5.26.1. It doesn’t.

I found out with help from #perl that newer versions of Perl don’t use the . element (working directory) in @INC any longer. RT’s 4.4.2 release notes under Server Administration state:

  • Avoid issues with modern Perl versions excluding ./ from @INC

This may be a bug because this doesn’t seem to be entirely true, perhaps the upgrade scripts haven’t been updated with this change. I was recommended to set PERL_USE_UNSAFE_INC=1 which adds the . element to @INC to work around the issue.

export PERL_USE_UNSAFE_INC=1

After adding this environmental variable, my ‘make upgrade-database’ ran successfully without any index errors.

I’d still appreciate any tips on the other warnings / errors if possible. I don’t believe they’ll have any affect, but a second set of eyes is always helpful.

Thanks.