Restore the error message when a tile can't be made small enough

This commit is contained in:
Eric Fischer 2015-10-19 13:39:44 -07:00
parent 3bb87227ec
commit 56910fd016

17
tile.cc
View File

@ -522,7 +522,7 @@ long long write_tile(char **geoms, char *metabase, char *stringpool, int z, unsi
deserialize_byte(geoms, &feature_minzoom); deserialize_byte(geoms, &feature_minzoom);
double progress = floor((((*geoms - geomstart + along) / (double) todo) + z) / (file_maxzoom + 1) * 1000) / 10; double progress = floor((((*geoms - geomstart + along) / (double) todo) + z) / (file_maxzoom + 1) * 1000) / 10;
if (progress != oprogress) { if (progress >= oprogress + 0.1) {
if (!quiet) { if (!quiet) {
fprintf(stderr, " %3.1f%% %d/%u/%u \r", progress, z, tx, ty); fprintf(stderr, " %3.1f%% %d/%u/%u \r", progress, z, tx, ty);
} }
@ -887,8 +887,9 @@ void *run_thread(void *vargs) {
long long len = write_tile(&geom, arg->metabase, arg->stringpool, z, x, y, z == arg->maxzoom ? arg->full_detail : arg->low_detail, arg->min_detail, arg->maxzoom, arg->file_keys, arg->layernames, arg->outdb, arg->droprate, arg->buffer, arg->fname, arg->geomfile, arg->minzoom, arg->maxzoom, arg->todo, geomstart, *arg->along, arg->gamma, arg->nlayers, arg->prevent, arg->additional, arg->child_shards); long long len = write_tile(&geom, arg->metabase, arg->stringpool, z, x, y, z == arg->maxzoom ? arg->full_detail : arg->low_detail, arg->min_detail, arg->maxzoom, arg->file_keys, arg->layernames, arg->outdb, arg->droprate, arg->buffer, arg->fname, arg->geomfile, arg->minzoom, arg->maxzoom, arg->todo, geomstart, *arg->along, arg->gamma, arg->nlayers, arg->prevent, arg->additional, arg->child_shards);
if (len < 0) { if (len < 0) {
return NULL; // XXX how to report errors from threads? int *err = (int *) malloc(sizeof(int));
// return z - 1; *err = z - 1;
return err;
} }
if (pthread_mutex_lock(&db_lock) != 0) { if (pthread_mutex_lock(&db_lock) != 0) {
@ -1055,12 +1056,18 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *metabase, char *stringpo
} }
} }
int err = INT_MAX;
for (thread = 0; thread < threads; thread++) { for (thread = 0; thread < threads; thread++) {
void *retval; void *retval;
if (pthread_join(pthreads[thread], &retval) != 0) { if (pthread_join(pthreads[thread], &retval) != 0) {
perror("pthread_join"); perror("pthread_join");
} }
if (retval != NULL) {
err = *((int *) retval);
}
} }
for (j = 0; j < TEMP_FILES; j++) { for (j = 0; j < TEMP_FILES; j++) {
@ -1076,6 +1083,10 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *metabase, char *stringpo
geomfd[j] = subfd[j]; geomfd[j] = subfd[j];
geom_size[j] = geomst.st_size; geom_size[j] = geomst.st_size;
} }
if (err != INT_MAX) {
return err;
}
} }
if (!quiet) { if (!quiet) {