Installation

Issue with Library Browser after upgrade to 2.19

Issue with Library Browser after upgrade to 2.19

by Anthony Weaver -
Number of replies: 2

I just upgraded to WebWork version 2.19 and I'm getting the following error when I select the Library Browser menu item

DBD::mysql::db selectall_arrayref failed: Unknown column 'pgf.libraryroot' in 'field list' at /opt/webwork/webwork2/lib/WeBWorK/DB/Schema/NewSQL/Std.pm line 930.

And the associated context

    925:             warn(
    926:                 "It looks like the database is missing a column.  You may need to upgrade your course tables.  If this is the admin course then you will need to upgrade the admin tables using the upgrade_admin_db.pl script."
    927:             );
    928:         }
    929:
    930:         die $errmsg;
    931:     }
    932: }
    933:
    934: sub DESTROY {
    935: }

I did run the update_admin_db.pl script as part of the upgrade and successfully updated all the courses.  I also ran OPL-update script with the following results:

/opt/webwork/webwork2/bin$ OPL-update
Downloading the latest OPL release.
Found OPL METADATA release v2024-08-14.
Downloaded release archive, now extracting.
remote: Enumerating objects: 17517, done.
remote: Counting objects: 100% (8045/8045), done.
remote: Compressing objects: 100% (2494/2494), done.
remote: Total 17517 (delta 5615), reused 7878 (delta 5488), pack-reused 9472 (from 1)
Receiving objects: 100% (17517/17517), 557.57 MiB | 77.81 MiB/s, done.
Resolving deltas: 100% (9515/9515), completed with 1060 local objects.
From https://github.com/openwebwork/webwork-open-problem-library
 * [new branch]            main        -> origin/main
 * [new tag]               v2022-05-30 -> v2022-05-30
 * [new tag]               v2022-08-15 -> v2022-08-15
 * [new tag]               v2022-4-15  -> v2022-4-15
 * [new tag]               v2023-04-30 -> v2023-04-30
 * [new tag]               v2024-08-13 -> v2024-08-13
 * [new tag]               v2024-08-14 -> v2024-08-14
Switching OPL clone in /opt/webwork/libraries/webwork-open-problem-library/ to new branch of release tag v2024-08-14.
error: Your local changes to the following files would be overwritten by checkout:
    OpenProblemLibrary/Rochester/setTrig03FunctionsRightAngle/srw6_2_11.pg
    OpenProblemLibrary/Rochester/setTrig03FunctionsRightAngle/srw6_2_3.pg
    OpenProblemLibrary/Rochester/setTrig03FunctionsRightAngle/srw6_2_7.pg
    OpenProblemLibrary/UVA-Stew5e/setUVA-Stew5e-C05S04-IndefInts/5-4-07.pg
Please commit your changes or stash them before you switch branches.
Aborting
Restoring OPL tables from release database dump.
OPL path seems to be /opt/webwork/libraries/webwork-open-problem-library/
ERROR 1046 (3D000) at line 22: No database selected
Removing temporary files.
Done!
Using WeBWorK root: /opt/webwork/webwork2
Using library root: /opt/webwork/libraries/webwork-open-problem-library/OpenProblemLibrary
Using contrib root: /opt/webwork/libraries/webwork-open-problem-library/Contrib
Saved OPL set definition list to /opt/webwork/webwork2/htdocs/DATA/library-set-defs.json.
Saved Contrib set definition list to /opt/webwork/webwork2/htdocs/DATA/contrib-set-defs.json.
Updating Library Statistics.
Importing statistics for 21 courses.
   1   2   3   4   5   6   7   8   9  10
  11  12  13  14  15  16  17  18  19  20
  21
You may want to run load-OPL-global-statistics.pl to update the global statistics data.
If this is being run by OPL-update, that will be done automatically.
Loading global statistics (if possible).
ERROR 1046 (3D000) at line 22: No database selected
Sharing aggregated statistics
WeBWorK and the Open Problem Library (OPL) are provided freely under an
open-source license. We ask that you share your OPL usage statistics for
the benefit of all who use WeBWorK. The following information will be shared
with the WeBWorK community if you agree:
* a list of OPL problems that have been used on your server, with
  the following statistics for each:
  * the total number of users who attempted the problem
  * the average number of attempts made per user on the problem
  * the average completion percentage for each user who attempted the problem
Share OPL usage statistics with the WeBWorK community [Y/N]:

I suspect the problem is the error: No database selected but I don't know where I should be looking to fix the issue.  Any guidance would be much appreciated

In reply to Anthony Weaver

Re: Issue with Library Browser after upgrade to 2.19

by Glenn Rice -

You have two problems which are shown in the output from the OPL-update script that you posted.

First, you have local changes to files in /opt/webwork/libraries/webwork-open-problem-library.  As a result git aborts when the script attempts to checkout the release branch.  So if the database is updated (it isn't because of the other error), then the information in the database won't match the files on disk.  This is what the following output means:

error: Your local changes to the following files would be overwritten by checkout:
    OpenProblemLibrary/Rochester/setTrig03FunctionsRightAngle/srw6_2_11.pg
    OpenProblemLibrary/Rochester/setTrig03FunctionsRightAngle/srw6_2_3.pg
    OpenProblemLibrary/Rochester/setTrig03FunctionsRightAngle/srw6_2_7.pg
    OpenProblemLibrary/UVA-Stew5e/setUVA-Stew5e-C05S04-IndefInts/5-4-07.pg
To fix this remove your local changes on those files. You could copy those files elsewhere, run the OPL-update script, and then copy those files back, if those local changes are something you want.

The other issue is ERROR 1046 (3D000) at line 22: No database selected that you noticed. This is certainly what is causing the error that is shown when you try to work with the library browser.  The database isn't actually being imported from the downloaded metadata release.  I am not exactly sure what is causing that, but something isn't right with your setup.  First check all of your database settings in site.conf and make sure they are correct.

In reply to Glenn Rice

Re: Issue with Library Browser after upgrade to 2.19

by Anthony Weaver -
Glenn,

Thanks I had just finished addressing the issue with git aborting because of problems being changed before you replied. It was indeed a database setting in site.conf. Our site.conf was still using this format for the database info:
$database_dsn="dbi:mysql:webwork"

I commented that out and made it match site.conf.dist which has:

# Modern database DSN format:
# DBI:driver:database=$database;host=$hostname;port=$port (when DB not on localhost)
# or DBI:driver:database=$database;host=127.0.0.1;port=$port (when DB on localhost, using TCP)
# See: https://metacpan.org/pod/DBD::MariaDB#port
# "To connect to a MariaDB or MySQL server on localhost using TCP/IP,
# you must specify the host as 127.0.0.1 with the optional port, e.g. 3306."
# or DBI:driver:database=$database (when DB on localhost, using socket)

# One thing on which it depends is the driver name, which you may want to modify.
# It also depends on the database name, which may be non-standard in some settings,
# as may be the hostname and port of the database server.

# driver should be one of:
# "mysql" for the DBD:mysql driver
# "MariaDB" for the DBD:mysql driver

# Select the desired DB driver:
$database_driver="mysql";
#$database_driver="MariaDB";

$database_host="localhost";
$database_port="3306";
$database_name="webwork";

# For a DB on localhost - default to using Unix socket.
# Change to 0 to use a TCP connection to 127.0.0.1.
$database_use_socket_if_localhost=1;

if ( $database_host eq "localhost" ) {
if ( $database_use_socket_if_localhost ) {
$database_dsn="DBI:$database_driver:database=$database_name";
} else {
$database_dsn="DBI:$database_driver:database=$database_name;host=127.0.0.1;port=$database_port";
}
} else {
$database_dsn="DBI:$database_driver:database=$database_name;host=$database_host;port=$database_port";
}

# The default storange engine to use is set here:
$database_storage_engine = 'myisam';