7323127b116915a7326941baf9cdc5303fc9db2d angie Thu Aug 13 11:34:02 2015 -0700 Fixing corner-case that caused the last item(s) to be lost when merge-sorting large-bin items and all items are in large bins. fixes #15867 diff --git src/hg/lib/annoStreamDb.c src/hg/lib/annoStreamDb.c index 1ca9e27..ca89901 100644 --- src/hg/lib/annoStreamDb.c +++ src/hg/lib/annoStreamDb.c @@ -400,32 +400,33 @@ if (rowBuf->ix > rowBuf->size) errAbort("annoStreamDb %s: rowBuf overflow (%d > %d)", self->streamer.name, rowBuf->ix, rowBuf->size); if (rowBuf->ix == rowBuf->size) { // Last row in buffer -- we'll need another query to get subsequent rows (if any). // But first, see if we need to update gotFinestBin, since getFinestBin might be // one of our callers. if (rowBuf->size > 0) { char **lastRow = rowBuf->buf[rowBuf->size-1]; int lastBin = atoi(lastRow[0]); if (lastBin >= self->minFinestBin) self->gotFinestBin = TRUE; } + if (self->bigItemQueue == NULL && self->smallItemQueue == NULL) self->needQuery = TRUE; - // Bounce back out -- asdNextRow will need to do another query. + // Bounce back out -- asdNextRow or nextRowMergeBins will need to do another query. return NULL; } if (rowBuf->size == 0) return NULL; else return rowBuf->buf[rowBuf->ix++]; } static char **nextRowFiltered(struct annoStreamDb *self, boolean *retRightFail, char *minChrom, uint minEnd) /* Skip past any left-join failures until we get a right-join failure, a passing row, * or end of data. Return row or NULL, and return right-join fail status via retRightFail. */ { int numCols = self->streamer.numCols; char **row = self->nextRowRaw(self);