8f8455798f19c20cfabbf11e16c21f8352a02e9c braney Sat Sep 19 07:04:47 2026 -0700 set ft_min_word_len=3 in browserSetup.sh so three-letter assembly names can be found in the assembly search box, refs #38387 The assembly search box asks hubApi for assemblies matching what was typed, and that lookup is a MySQL FULLTEXT search over hgcentral.assemblyList. The table is MyISAM, so ft_min_word_len decides the shortest word that gets into the index. Mariadb defaults to 4, which leaves out every three-letter assembly name, so hs1, rn7 and dm6 could not be found in a mirror or in a released docker image. hgwdev has always run with 3, which is why the same search worked here. updateBlatServers now sets the value, restarts Mariadb and then loads hgcentral.sql. That order matters: the new value is only live after a restart, and the FULLTEXT index is rebuilt by the DROP TABLE, CREATE and INSERT of assemblyList in that dump, so no REPAIR is needed. updateBlatServers is the one place hgcentral is reloaded, reached from mysqlDbSetup on install and from cgiUpdate on both cgiUpdate and update, so one call site covers every path and every OS. An error from the init script is tolerated around the restart. In the docker image Mariadb runs under runit, so a stop shuts the server down, the supervisor starts it again a second later, and the init script reports a failure although the restart worked. The running value is checked afterwards, and a warning names the REPAIR command if it did not take. Tested in a stock container that had ft_min_word_len=4 and no assemblyList table at all. Afterwards hs1, rn7 and dm6 are all found through hubApi/findGenome?browser=mustExist, with hs1 first for a search of hs1. diff --git src/product/installer/browserSetup.sh src/product/installer/browserSetup.sh index 28552311d18..da15636d002 100755 --- src/product/installer/browserSetup.sh +++ src/product/installer/browserSetup.sh @@ -543,30 +543,60 @@ echo Could not find my.cnf. Adapt 'setMYCNF()' in browserSetup.sh and/or contact us. exit 1 fi echo Found Mariadb config file: $MYCNF } function mysqlStrictModeOff () { # make sure that missing values in mysql insert statements do not trigger errors, #18368 = deactivate strict mode # This must happen before Mariadb is started or alternative Mariadb must be restarted after this has been done setMYCNF echo Deactivating MySQL strict mode sed -Ei '/^\[(mysqld|server)\]$/a sql_mode=' $MYCNF } +# The assembly search box asks hubApi for assemblies matching what was typed, and that +# lookup is a MySQL FULLTEXT search over hgcentral.assemblyList. The table is MyISAM, so +# ft_min_word_len decides the shortest word that gets into the index. Mariadb defaults to +# 4, which leaves out every three-letter assembly name, so hs1, rn7 and dm6 cannot be found +# in the search box. UCSC runs with 3. Returns 0 if the config file was changed, in which +# case Mariadb has to be restarted for the new value to take effect. refs #38387 +function mysqlSetFtMinWordLen () +{ + # setMYCNF exits when it cannot find the config file, so run it in a subshell and + # treat a failure as "nothing to change" rather than letting it kill an update + local cnf + cnf=$( setMYCNF > /dev/null 2>&1; echo "$MYCNF" ) || true + if [ -z "$cnf" ] ; then + echo2 Could not find the Mariadb config file, leaving ft_min_word_len alone + return 1 + fi + if grep -q '^[[:space:]]*ft_min_word_len' $cnf ; then + return 1 + fi + echo2 Setting ft_min_word_len=3 in $cnf, so three-letter assembly names like hs1 can be found in the assembly search box + sed -Ei '/^\[(mysqld|server)\]$/a ft_min_word_len=3' $cnf + if ! grep -q '^ft_min_word_len=3' $cnf ; then + # no [mysqld] or [server] section to add it to, so say so rather than trying + # again, and restarting Mariadb, on every later run + echo2 Warning: could not add ft_min_word_len to $cnf, add it by hand under [mysqld] + return 1 + fi + return 0 +} + function mysqlAllowOldPasswords # mysql >= 8 does not allow the old passwords anymore. But our client is still compiled # with the old, non-SHA256 encryption. So we must deactivate this new feature. # We do not support MySQL anymore, so this function could be removed { echo2 'Checking for Mysql version >= 8 (not officially supported by our software)' MYSQLMAJ=`mysql -e 'SHOW VARIABLES LIKE "version";' -NB | cut -f2 | cut -d. -f1` setMYCNF if [ "$MYSQLMAJ" -ge 8 ] ; then echo2 'Mysql/MariaDB >= 8 found, checking if default-authentication allows native passwords' if grep -q default-authentication $MYCNF; then echo2 "default-authentication already set in $MYCNF" else echo2 Changing $MYCNF to allow native passwords and restarting Mysql @@ -2068,30 +2098,45 @@ downloadFile $UDRURL > /usr/local/bin/udr chmod a+x /usr/local/bin/udr fi } function cleanTrash () { echo2 Removing files older than one day in $TRASHDIR, not running on $TRASHDIR/ct # -L = follow symlinks # -atime +1 = files older than one day find -L $TRASHDIR -not -path $TRASHDIR/ct/\* -and -type f -atime +1 -exec rm -f {} \; } function updateBlatServers () { + # A new ft_min_word_len only takes effect after a restart, and the FULLTEXT index on + # assemblyList is rebuilt by the hgcentral load below, so both have to happen first + if mysqlSetFtMinWordLen ; then + # an error from the init script is tolerated here: when Mariadb is under a + # supervisor, as it is in our docker image, it comes back on its own and "stop" + # reports a failure even though the restart worked + stopMysql || true + startMysql || true + minWordLen=`$MYSQL -NBe 'select @@ft_min_word_len' 2> /dev/null` || minWordLen=unknown + if [ "$minWordLen" != "3" ] ; then + echo2 Warning: Mariadb reports ft_min_word_len=$minWordLen after the restart, so three-letter assembly names will still not be found in the search box. + echo2 Restart Mariadb by hand, then run: mysql -e '"REPAIR TABLE hgcentral.assemblyList QUICK"' + fi + fi + echo2 Creating or updating the BLAT servers table downloadFile http://$HGDOWNLOAD/admin/hgcentral.sql | $MYSQL hgcentral # the blat servers don't have fully qualified dom names in the download data $MYSQL hgcentral -e 'UPDATE blatServers SET host=CONCAT(host,".soe.ucsc.edu");' # just in case that we ever add fully qualified dom names $MYSQL hgcentral -e 'UPDATE blatServers SET host=replace(host,".soe.ucsc.edu.soe.ucsc.edu", ".soe.ucsc.edu");' } function cgiUpdate () { # update the CGIs $RSYNC -avzP --exclude=RNAplot --exclude=hg.conf --exclude=hg.conf.local $HGDOWNLOAD::cgi-bin/ $APACHEDIR/cgi-bin/ # update the html docs echo2 Updating Apache htdocs $RSYNC -avzP --exclude=*.{bb,bam,bai,bw,gz,2bit,bed} --exclude=ENCODE --exclude=trash $HGDOWNLOAD::htdocs/ $APACHEDIR/htdocs/