mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-07 10:34:08 +00:00
Merge pull request #3090 from mtmail/check-database-on-frozen-database
check-database on frozen db shouldnt recommend indexing
This commit is contained in:
@@ -15,6 +15,7 @@ from nominatim.config import Configuration
|
|||||||
from nominatim.db.connection import connect, Connection
|
from nominatim.db.connection import connect, Connection
|
||||||
from nominatim.errors import UsageError
|
from nominatim.errors import UsageError
|
||||||
from nominatim.tokenizer import factory as tokenizer_factory
|
from nominatim.tokenizer import factory as tokenizer_factory
|
||||||
|
from nominatim.tools import freeze
|
||||||
|
|
||||||
CHECKLIST = []
|
CHECKLIST = []
|
||||||
|
|
||||||
@@ -223,6 +224,12 @@ def check_indexing(conn: Connection, _: Configuration) -> CheckResult:
|
|||||||
if cnt == 0:
|
if cnt == 0:
|
||||||
return CheckState.OK
|
return CheckState.OK
|
||||||
|
|
||||||
|
if freeze.is_frozen(conn):
|
||||||
|
index_cmd="""\
|
||||||
|
Database is marked frozen, it cannot be updated.
|
||||||
|
Low counts of unindexed places are fine."""
|
||||||
|
return CheckState.WARN, dict(count=cnt, index_cmd=index_cmd)
|
||||||
|
|
||||||
if conn.index_exists('idx_placex_rank_search'):
|
if conn.index_exists('idx_placex_rank_search'):
|
||||||
# Likely just an interrupted update.
|
# Likely just an interrupted update.
|
||||||
index_cmd = 'nominatim index'
|
index_cmd = 'nominatim index'
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ def test_check_indexing_good(table_factory, temp_db_conn, def_config):
|
|||||||
def test_check_indexing_bad(table_factory, temp_db_conn, def_config):
|
def test_check_indexing_bad(table_factory, temp_db_conn, def_config):
|
||||||
table_factory('placex', 'place_id int, indexed_status smallint',
|
table_factory('placex', 'place_id int, indexed_status smallint',
|
||||||
content=((1, 0), (2, 2)))
|
content=((1, 0), (2, 2)))
|
||||||
assert chkdb.check_indexing(temp_db_conn, def_config) == chkdb.CheckState.FAIL
|
assert chkdb.check_indexing(temp_db_conn, def_config) == chkdb.CheckState.WARN
|
||||||
|
|
||||||
|
|
||||||
def test_check_database_indexes_bad(temp_db_conn, def_config):
|
def test_check_database_indexes_bad(temp_db_conn, def_config):
|
||||||
|
|||||||
Reference in New Issue
Block a user