Skip to content

creating bm25 index fails

Repeated on haf_api_node on different machines Here is situation from hive-3:

sqlalchemy.exc.InternalError: (psycopg2.errors.DataCorrupted) unexpected chunk number 3 (expected 1) for toast value 11873023 in pg_toast_20706

[SQL: CREATE INDEX hive_post_data_bm25_idx ON hivemind_app.hive_post_data USING bm25 (id, title, body) WITH (key_field = 'id', text_fields = '{"title": {"record": "position"}, "body": {"record": "position"}}') WHERE hivemind_app.is_top_level_post(id)]
(Background on this error at: https://sqlalche.me/e/14/2j85)

COMPOSE_PROFILES="core,admin,servers,apps,monitoring"

In postgres log we have:

2025-10-06 04:09:48 UTC [690323]: app=hivemind_hive_post_data ERROR:  unexpected chunk number 3 (expected 1) for toast value 11873023 in pg_toast_20706
2025-10-06 04:09:48 UTC [690323]: app=hivemind_hive_post_data STATEMENT:  CREATE INDEX hive_post_data_bm25_idx ON hivemind_app.hive_post_data USING bm25 (id, title, body) WITH (key_field = 'id', text_fields = '{"title": {"record": "position"}, "body": {"record": "position"}}') WHERE hivemind_app.is_top_level_post(id)
2025-10-06 04:09:48 UTC [159818]: app=hivemind_PostDataCache LOG:  process 159818 acquired RowExclusiveLock on relation 20706 of database 16397 after 3050275.978 ms at character 123174
2025-10-06 04:09:48 UTC [159818]: app=hivemind_PostDataCache STATEMENT:  
	                    WITH insert_values(id, is_root, title, body, json) AS (

It suggest that that the index is being created simultaneous with updating post_data_cache in another threadhivemind.log

Edited by Marcin