f5ba6de31304850e1650c1a785f717971cbfa4a8 braney Tue Aug 2 12:28:30 2016 -0700 fix problem with bigBed code calling SQL code during parallel load. This causes a crash because SQL code is not thread safe. diff --git src/hg/hgTracks/bigBedTrack.c src/hg/hgTracks/bigBedTrack.c index cb2fffa..009f12e 100644 --- src/hg/hgTracks/bigBedTrack.c +++ src/hg/hgTracks/bigBedTrack.c @@ -92,55 +92,30 @@ track->bbiFile = NULL; } errCatchEnd(errCatch); if (errCatch->gotError) { track->networkErrMsg = cloneString(errCatch->message->string); track->drawItems = bigDrawWarning; track->totalHeight = bigWarnTotalHeight; result = NULL; } errCatchFree(&errCatch); return result; } -int bbExtraFieldIndex(struct trackDb *tdb, char* fieldName) -/* return the index of a given extra field from the bbInterval - * 0 is the name-field of bigBed and is used as an error code - * as this is the default anyways */ -{ -if (fieldName==NULL) - return 0; -// copied from hgc.c -// get .as file for track -struct sqlConnection *conn = NULL ; -if (!trackHubDatabase(database)) - conn = hAllocConnTrack(database, tdb); -struct asObject *as = asForTdb(conn, tdb); -hFreeConn(&conn); -if (as == NULL) - return 0; - -// search for field name, return index if found -struct asColumn *col = as->columnList; -int ix = 0; -for (;col != NULL;col=col->next, ix+=1) - if (sameString(col->name, fieldName)) - return max(ix-3, 0); // never return a negative value -return 0; -} char* restField(struct bigBedInterval *bb, int fieldIdx) /* return a given field from the bb->rest field, NULL on error */ { if (fieldIdx==0) // we don't return the first(=name) field of bigBed return NULL; char *rest = cloneString(bb->rest); char *restFields[256]; int restCount = chopTabs(rest, restFields); char *field = NULL; if (fieldIdx < restCount) field = cloneString(restFields[fieldIdx]); freeMem(rest); return field; } @@ -151,31 +126,32 @@ int fieldCount, struct linkedFeatures **pLfList) /* Read in items in chrom:start-end from bigBed file named in track->bbiFileName, convert * them to linkedFeatures, and add to head of list. */ { struct lm *lm = lmInit(0); struct trackDb *tdb = track->tdb; struct bigBedInterval *bb, *bbList = bigBedSelectRange(track, chrom, start, end, lm); char *bedRow[32]; char startBuf[16], endBuf[16]; char *scoreFilter = cartOrTdbString(cart, track->tdb, "scoreFilter", NULL); char *mouseOverField = cartOrTdbString(cart, track->tdb, "mouseOverField", NULL); int minScore = 0; if (scoreFilter) minScore = atoi(scoreFilter); -int mouseOverIdx = bbExtraFieldIndex(tdb, mouseOverField); +struct bbiFile *bbi = fetchBbiForTrack(track); +int mouseOverIdx = bbExtraFieldIndex(bbi, mouseOverField); for (bb = bbList; bb != NULL; bb = bb->next) { bigBedIntervalToRow(bb, chromName, startBuf, endBuf, bedRow, ArraySize(bedRow)); struct linkedFeatures *lf; if (sameString(track->tdb->type, "bigPsl")) { char *seq, *cds; struct psl *psl = pslFromBigPsl(chromName, bb, &seq, &cds); int sizeMul = 1; // we're assuming not protein at the moment boolean isXeno = 0; // just affects grayIx boolean nameGetsPos = FALSE; // we want the name to stay the name lf = lfFromPslx(psl, sizeMul, isXeno, nameGetsPos, track); lf->original = psl;