X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/4d16677d2ee4e57cef44d7a208b15b390d5994f4..d7c3f04e04b709a989bdf76987b8843ce949cfe3:/nominatim/index.c?ds=sidebyside diff --git a/nominatim/index.c b/nominatim/index.c index b6dd7236..13f29273 100644 --- a/nominatim/index.c +++ b/nominatim/index.c @@ -127,13 +127,13 @@ void nominatim_index(int rank_min, int rank_max, int num_threads, const char *co } PQclear(res); - res = PQexec(thread_data[i].conn, "set enable_seqscan = false"); + /*res = PQexec(thread_data[i].conn, "set enable_seqscan = false"); if (PQresultStatus(res) != PGRES_COMMAND_OK) { fprintf(stderr, "Failed disabling sequential scan: %s\n", PQerrorMessage(conn)); exit(EXIT_FAILURE); } - PQclear(res); + PQclear(res);*/ nominatim_exportCreatePreparedQueries(thread_data[i].conn); } @@ -145,7 +145,7 @@ void nominatim_index(int rank_min, int rank_max, int num_threads, const char *co writer = nominatim_exportXMLStart(structuredoutputfile); } - fprintf(stderr, "Starting indexing rank (%i to %i) using %i treads\n", rank_min, rank_max, num_threads); + fprintf(stderr, "Starting indexing rank (%i to %i) using %i threads\n", rank_min, rank_max, num_threads); for (rank = rank_min; rank <= rank_max; rank++) { @@ -308,6 +308,13 @@ void nominatim_index(int rank_min, int rank_max, int num_threads, const char *co { nominatim_exportXMLEnd(writer); } + + // Close all connections + for (i = 0; i < num_threads; i++) + { + PQfinish(thread_data[i].conn); + } + PQfinish(conn); } void *nominatim_indexThread(void * thread_data_in) @@ -359,7 +366,7 @@ void *nominatim_indexThread(void * thread_data_in) done = 1; else { - if (strncmp(PQerrorMessage(thread_data->conn), "ERROR: deadlock detected", 25)) + if (!strncmp(PQerrorMessage(thread_data->conn), "ERROR: deadlock detected", 25)) { fprintf(stderr, "index_placex: UPDATE failed - deadlock, retrying (%ld)\n", place_id); PQclear(res); @@ -369,8 +376,7 @@ void *nominatim_indexThread(void * thread_data_in) { fprintf(stderr, "index_placex: UPDATE failed: %s", PQerrorMessage(thread_data->conn)); PQclear(res); - sleep(rand() % 10); -// exit(EXIT_FAILURE); + exit(EXIT_FAILURE); } } }