This is a document for PGroonga 2.X and 3.X. See PGroonga 1.x document when you're using old PGroonga.
pgroonga_list_broken_indexes
functionSince 3.2.1.
pgroonga_list_broken_indexes
function displays potentially broken PGroonga indexes.
If a crash occurs while updating data, it is highly probable that PGroonga's indexes are broken. Also, in such cases, the following two conditions are often observed. Therefore, those conditions are considered as broken and detected.
The lock remains
Some needed files don't exist
Note that this is a simple check and may not detect broken indexes.
Here is the syntax of this function:
SETOF text pgroonga_list_broken_indexes()
It get indexes that may be broken in PGroonga indexes.
It returns the following records:
pgroonga_list_broken_indexes
------------------------------
pgrn_memos_index
SELECT pgroonga_list_broken_indexes();
Here are sample schema:
CREATE TABLE memos (
content text
);
CREATE INDEX pgrn_memos_index ON memos USING PGroonga (content);
No possibility of broken:
SELECT pgroonga_list_broken_indexes();
pgroonga_list_broken_indexes
------------------------------
(0 rows)
Possible broken (Locks remain):
SELECT pgroonga_command(
'lock_acquire',
ARRAY['target_name', pgroonga_table_name('pgrn_memos_index')]
);
pgroonga_command
---------------------------------------------------
[[0,1716796614.02342,6.723403930664062e-05],true]
(1 row)
SELECT pgroonga_list_broken_indexes();
pgroonga_list_broken_indexes
------------------------------
pgrn_memos_index
(1 row)
No possibility of broken (Lock already released):
SELECT pgroonga_command(
'lock_release',
ARRAY['target_name', pgroonga_table_name('pgrn_memos_index')]
);
pgroonga_command
----------------------------------------------------
[[0,1716796558.739785,4.720687866210938e-05],true]
(1 row)
SELECT pgroonga_list_broken_indexes();
pgroonga_list_broken_indexes
------------------------------
(0 rows)