bc4639b87acf68232656130b2972293975e11933
braney
  Thu Sep 10 12:43:45 2026 -0700
genark: tolerate a missing or stale genarkOrg table, refs #38327

genarkGetOrgHash() aborted when the central database had no genarkOrg
table.  A mirror's hgcentral has never had one: buildHgCentralSql.csh did
not list the table, so hgcentral.sql on hgdownload carries neither its rows
nor its schema.  Add an sqlTableExists check, and add genarkOrg to the list
of tables that hgcentral.sql replaces entirely.

genarkMakeDbDb() defaulted genome to "Other" for an accession with no
genarkOrg row, but left organism NULL.  hgConvert prints organism, so the
Convert page read "Genome: (null)".  Default both.  The copy of genarkOrg
on the RR is 20,754 rows behind hgwdev, so this is visible on
genome.ucsc.edu today for 23 of the 855 GenArk assemblies that appear in
liftOverChain.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

diff --git src/utils/qa/weeklybld/buildHgCentralSql.csh src/utils/qa/weeklybld/buildHgCentralSql.csh
index 6186d6b3f8b..15cedbb4f58 100755
--- src/utils/qa/weeklybld/buildHgCentralSql.csh
+++ src/utils/qa/weeklybld/buildHgCentralSql.csh
@@ -16,31 +16,31 @@
 cd ${BUILDHOME}/build-hgdownload/admin
 git pull origin master
 
 ### Creates these tables only
 set CREATE_ONLY="sessionDb userDb hubStatus gbMembers namedSessionDb apiKeys"
 set CREATE_OR_LIST=`echo "${CREATE_ONLY}" | sed -e "s/ /|/g"`
 set IGNORE_TABLES=`hgsql -N -h genome-centdb -e "show tables;" hgcentral \
      | egrep -v -w "${CREATE_OR_LIST}" | xargs echo \
      | sed -e "s/^/--ignore-table=hgcentral./; s/ / --ignore-table=hgcentral./g"`
 hgsqldump --skip-add-drop-table --skip-lock-tables --no-data ${IGNORE_TABLES} \
           -h genome-centdb --no-create-db --databases hgcentral  | grep -v "^USE " \
          | sed -e "s/genome-centdb/localhost/; s/CREATE TABLE/CREATE TABLE IF NOT EXISTS/" \
     > /tmp/hgcentraltemp.sql 
 
 ### Creates and fills (replacing entirely) these tables
-set REPLACE_ENTIRELY="blatServers dbDb defaultCart liftOverChain quickLiftChain asmAlias assemblyList genark"
+set REPLACE_ENTIRELY="blatServers dbDb defaultCart liftOverChain quickLiftChain asmAlias assemblyList genark genarkOrg"
 set CREATE_OR_LIST=`echo "${REPLACE_ENTIRELY}" | sed -e "s/ /|/g"`
 set IGNORE_TABLES=`hgsql -N -h genome-centdb -e "show tables;" hgcentral \
      | egrep -v -w "${CREATE_OR_LIST}" | xargs echo \
      | sed -e "s/^/--ignore-table=hgcentral./; s/ / --ignore-table=hgcentral./g"`
 # --order-by-primary ... to make it dump rows in a stable repeatable order if it has an index
 # --skip-extended-insert ... to make it dump rows as separate insert statements
 # --skip-add-drop-table ... to avoid dropping existing tables
 # Note that INSERT is turned into REPLACE making our table contents dominant, 
 #      but users additional rows are preserved
 hgsqldump ${IGNORE_TABLES} --skip-lock-tables --skip-extended-insert --order-by-primary -c -h genome-centdb \
         --no-create-db --databases hgcentral  | grep -v "^USE " | sed -e \
         "s/genome-centdb/localhost/" \
     >> /tmp/hgcentraltemp.sql
 
 ### Creates and fills (replacing uniquely keyed rows only) these tables