mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-11 13:24:07 +00:00
stop treating capital cities as villages, memory leak on deadlock
This commit is contained in:
@@ -367,7 +367,7 @@ void nominatim_exportPlace(uint64_t place_id, PGconn * conn,
|
|||||||
// Add, modify or delete?
|
// Add, modify or delete?
|
||||||
if (prevQuerySet)
|
if (prevQuerySet)
|
||||||
{
|
{
|
||||||
if ((PQgetvalue(prevQuerySet->res, 0, 14) && strcmp(PQgetvalue(prevQuerySet->res, 0, 14), "100") == 0) || PQntuples(querySet.res))
|
if ((PQgetvalue(prevQuerySet->res, 0, 14) && strcmp(PQgetvalue(prevQuerySet->res, 0, 14), "100") == 0) || PQntuples(querySet.res) == 0)
|
||||||
{
|
{
|
||||||
// Delete
|
// Delete
|
||||||
if (writer_mutex) pthread_mutex_lock( writer_mutex );
|
if (writer_mutex) pthread_mutex_lock( writer_mutex );
|
||||||
|
|||||||
@@ -343,13 +343,14 @@ void *nominatim_indexThread(void * thread_data_in)
|
|||||||
|
|
||||||
updateStartTime = time(0);
|
updateStartTime = time(0);
|
||||||
int done = 0;
|
int done = 0;
|
||||||
|
|
||||||
|
if (thread_data->writer)
|
||||||
|
{
|
||||||
|
nominatim_exportPlaceQueries(place_id, thread_data->conn, &querySet);
|
||||||
|
}
|
||||||
|
|
||||||
while(!done)
|
while(!done)
|
||||||
{
|
{
|
||||||
if (thread_data->writer)
|
|
||||||
{
|
|
||||||
nominatim_exportPlaceQueries(place_id, thread_data->conn, &querySet);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
paramPlaceID = PGint32(place_id);
|
paramPlaceID = PGint32(place_id);
|
||||||
paramValues[0] = (char *)¶mPlaceID;
|
paramValues[0] = (char *)¶mPlaceID;
|
||||||
@@ -363,12 +364,14 @@ void *nominatim_indexThread(void * thread_data_in)
|
|||||||
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\n");
|
fprintf(stderr, "index_placex: UPDATE failed - deadlock, retrying\n");
|
||||||
|
PQclear(res);
|
||||||
|
sleep(rand() % 10);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "index_placex: UPDATE failed: %s", PQerrorMessage(thread_data->conn));
|
fprintf(stderr, "index_placex: UPDATE failed: %s", PQerrorMessage(thread_data->conn));
|
||||||
PQclear(res);
|
PQclear(res);
|
||||||
sleep(5);
|
sleep(rand() % 10);
|
||||||
// exit(EXIT_FAILURE);
|
// exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1477,9 +1477,12 @@ BEGIN
|
|||||||
-- try using the isin value to find parent places
|
-- try using the isin value to find parent places
|
||||||
IF array_upper(isin_tokens, 1) IS NOT NULL THEN
|
IF array_upper(isin_tokens, 1) IS NOT NULL THEN
|
||||||
FOR i IN 1..array_upper(isin_tokens, 1) LOOP
|
FOR i IN 1..array_upper(isin_tokens, 1) LOOP
|
||||||
--RAISE WARNING ' ISIN: % % % %',NEW.partition, place_centroid, search_maxrank, isin_tokens[i];
|
--RAISE WARNING ' getNearestNamedFeature: % % % %',NEW.partition, place_centroid, search_maxrank, isin_tokens[i];
|
||||||
|
|
||||||
FOR location IN SELECT * from getNearestNamedFeature(NEW.partition, place_centroid, search_maxrank, isin_tokens[i]) LOOP
|
FOR location IN SELECT * from getNearestNamedFeature(NEW.partition, place_centroid, search_maxrank, isin_tokens[i]) LOOP
|
||||||
|
|
||||||
|
--RAISE WARNING ' ISIN: %',location;
|
||||||
|
|
||||||
nameaddress_vector := array_merge(nameaddress_vector, location.keywords::integer[]);
|
nameaddress_vector := array_merge(nameaddress_vector, location.keywords::integer[]);
|
||||||
INSERT INTO place_addressline VALUES (NEW.place_id, location.place_id, false, NOT address_havelevel[location.rank_address], location.distance, location.rank_address);
|
INSERT INTO place_addressline VALUES (NEW.place_id, location.place_id, false, NOT address_havelevel[location.rank_address], location.distance, location.rank_address);
|
||||||
address_havelevel[location.rank_address] := true;
|
address_havelevel[location.rank_address] := true;
|
||||||
|
|||||||
@@ -61,7 +61,13 @@ BEGIN
|
|||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT * FROM location_area_country WHERE ST_Contains(geometry, point) and rank_search < maxrank
|
SELECT * FROM location_area_country WHERE ST_Contains(geometry, point) and rank_search < maxrank
|
||||||
) as location_area
|
) as location_area
|
||||||
ORDER BY rank_address desc, isin_tokens && keywords desc, isguess asc, ST_Distance(point, centroid) * CASE WHEN rank_address = 16 AND rank_search = 16 THEN 0.25 WHEN rank_address = 16 AND rank_search = 17 THEN 0.5 ELSE 1 END ASC
|
ORDER BY rank_address desc, isin_tokens && keywords desc, isguess asc,
|
||||||
|
ST_Distance(point, centroid) *
|
||||||
|
CASE
|
||||||
|
WHEN rank_address = 16 AND rank_search = 15 THEN 0.2 -- capital city
|
||||||
|
WHEN rank_address = 16 AND rank_search = 16 THEN 0.25 -- city
|
||||||
|
WHEN rank_address = 16 AND rank_search = 17 THEN 0.5 -- town
|
||||||
|
ELSE 1 END ASC -- everything else
|
||||||
LOOP
|
LOOP
|
||||||
RETURN NEXT r;
|
RETURN NEXT r;
|
||||||
END LOOP;
|
END LOOP;
|
||||||
|
|||||||
Reference in New Issue
Block a user