73df2d32a412c779c00f7dcdc46bbbe2cdcce629 galt Mon Mar 26 12:09:59 2012 -0700 mysql load data file warnings abort - adding some caution about changing stuff, so for now warning detection activates only on hgwdev, hgwbeta, hgwalpha but not RR or mirrors (yet) diff --git src/hg/lib/jksql.c src/hg/lib/jksql.c index 784c52f..36113c2 100644 --- src/hg/lib/jksql.c +++ src/hg/lib/jksql.c @@ -1329,32 +1329,41 @@ safef(query, sizeof(query), "LOAD DATA %s %s INFILE '%s' %s INTO TABLE %s", concurrentOpt, localOpt, tabPath, dupOpt, table); sr = sqlGetResult(conn, query); monitorEnter(); info = mysql_info(conn->conn); monitorLeave(); if (info == NULL) errAbort("no info available for result of sql query: %s", query); numScan = sscanf(info, "Records: %d Deleted: %*d Skipped: %d Warnings: %d", &numRecs, &numSkipped, &numWarnings); if (numScan != 3) errAbort("can't parse sql load info: %s", info); sqlFreeResult(&sr); +char *host = getenv("HOST"); +if ( // TODO 2012/03/26 this is temporary and we should eventually get to always checking the warnings. + ( sameOk(host,"hgwdev") + || sameOk(host,"hgwbeta") + || sameOk(host,"hgwalpha") + ) + && !sameOk(cfgOption("detectMysqlLoadWarnings"), "off")) // go gently in case of backwards-compatibility issues + { /* mysql 5.0 bug: mysql_info returns unreliable warnings count, so use this instead: */ numWarnings = sqlWarnCount(conn); + } if ((numSkipped > 0) || (numWarnings > 0)) { boolean doAbort = TRUE; if ((numSkipped > 0) && (options & SQL_TAB_FILE_WARN_ON_ERROR)) doAbort = FALSE; /* don't abort on errors */ else if ((numWarnings > 0) && (options & (SQL_TAB_FILE_WARN_ON_ERROR|SQL_TAB_FILE_WARN_ON_WARN))) doAbort = FALSE; /* don't abort on warnings */ if (numWarnings > 0) { sqlWarnings(conn, 10); /* show the first 10 warnings */ } if (doAbort) errAbort("load of %s did not go as planned: %d record(s), "