mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
fail on error
- stop indexing if there is any other error than deadlock from the DB - stop import if osm2pgsql or indexing fails
This commit is contained in:
@@ -369,8 +369,7 @@ void *nominatim_indexThread(void * thread_data_in)
|
|||||||
{
|
{
|
||||||
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(rand() % 10);
|
exit(EXIT_FAILURE);
|
||||||
// exit(EXIT_FAILURE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,7 +129,7 @@
|
|||||||
$osm2pgsql .= ' -lsc -O gazetteer --hstore';
|
$osm2pgsql .= ' -lsc -O gazetteer --hstore';
|
||||||
$osm2pgsql .= ' -C '.$iCacheMemory;
|
$osm2pgsql .= ' -C '.$iCacheMemory;
|
||||||
$osm2pgsql .= ' -d '.$aDSNInfo['database'].' '.$aCMDResult['osm-file'];
|
$osm2pgsql .= ' -d '.$aDSNInfo['database'].' '.$aCMDResult['osm-file'];
|
||||||
passthru($osm2pgsql);
|
passthruCheckReturn($osm2pgsql);
|
||||||
|
|
||||||
$oDB =& getDB();
|
$oDB =& getDB();
|
||||||
$x = $oDB->getRow('select * from place limit 1');
|
$x = $oDB->getRow('select * from place limit 1');
|
||||||
@@ -457,11 +457,11 @@
|
|||||||
$sOutputFile = '';
|
$sOutputFile = '';
|
||||||
if (isset($aCMDResult['index-output'])) $sOutputFile = ' -F '.$aCMDResult['index-output'];
|
if (isset($aCMDResult['index-output'])) $sOutputFile = ' -F '.$aCMDResult['index-output'];
|
||||||
$sBaseCmd = CONST_BasePath.'/nominatim/nominatim -i -d '.$aDSNInfo['database'].' -t '.$iInstances.$sOutputFile;
|
$sBaseCmd = CONST_BasePath.'/nominatim/nominatim -i -d '.$aDSNInfo['database'].' -t '.$iInstances.$sOutputFile;
|
||||||
passthru($sBaseCmd.' -R 4');
|
passthruCheckReturn($sBaseCmd.' -R 4');
|
||||||
if (!$aCMDResult['index-noanalyse']) pgsqlRunScript('ANALYSE');
|
if (!$aCMDResult['index-noanalyse']) pgsqlRunScript('ANALYSE');
|
||||||
passthru($sBaseCmd.' -r 5 -R 25');
|
passthruCheckReturn($sBaseCmd.' -r 5 -R 25');
|
||||||
if (!$aCMDResult['index-noanalyse']) pgsqlRunScript('ANALYSE');
|
if (!$aCMDResult['index-noanalyse']) pgsqlRunScript('ANALYSE');
|
||||||
passthru($sBaseCmd.' -r 26');
|
passthruCheckReturn($sBaseCmd.' -r 26');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($aCMDResult['create-search-indices'] || $aCMDResult['all'])
|
if ($aCMDResult['create-search-indices'] || $aCMDResult['all'])
|
||||||
@@ -625,3 +625,10 @@
|
|||||||
|
|
||||||
proc_close($hProcess);
|
proc_close($hProcess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function passthruCheckReturn($cmd)
|
||||||
|
{
|
||||||
|
$result = -1;
|
||||||
|
passthru($cmd, $result);
|
||||||
|
if ($result != 0) fail('Error executing external command: '.$cmd);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user