| 1 |
.. -*- rst -*- |
| 2 |
|
| 3 |
.. groonga-command |
| 4 |
.. database: commands_index_column_diff |
| 5 |
|
| 6 |
``index_column_diff`` |
| 7 |
===================== |
| 8 |
|
| 9 |
Summary |
| 10 |
------- |
| 11 |
|
| 12 |
.. versionadded:: 9.0.1 |
| 13 |
|
| 14 |
``index_column_diff`` command check where indexes are broken or not. |
| 15 |
|
| 16 |
We can found already a broken index by this command. |
| 17 |
Normally, we don't found it unless Groonga refer, delete, or update it. |
| 18 |
However, it is possible that Groonga crashes or returns wrong search |
| 19 |
results by using it. |
| 20 |
it make us want to found it in advance. |
| 21 |
This command useful in this case. |
| 22 |
|
| 23 |
.. note:: |
| 24 |
|
| 25 |
This command may use many memory and execution time depending on the size of the target index. |
| 26 |
Also, if we stop in the middle of execution of this command, the target index may break. |
| 27 |
Therefore, we suggest that we don't execute this command on active system, but execute |
| 28 |
this command on standby system. |
| 29 |
|
| 30 |
Syntax |
| 31 |
------ |
| 32 |
|
| 33 |
Here is the syntax of this command:: |
| 34 |
|
| 35 |
index_column_diff table |
| 36 |
name |
| 37 |
[progress_log_level=debug] |
| 38 |
|
| 39 |
Usage |
| 40 |
----- |
| 41 |
|
| 42 |
Here is an example to check a index column in the database: |
| 43 |
|
| 44 |
.. groonga-command |
| 45 |
.. include:: ../../example/reference/commands/index_column_diff/index_column.log |
| 46 |
.. table_create Data TABLE_HASH_KEY ShortText |
| 47 |
.. table_create Terms TABLE_PAT_KEY ShortText \ |
| 48 |
.. --default_tokenizer TokenNgram \ |
| 49 |
.. --normalizer NormalizerNFKC130 |
| 50 |
.. load --table Data |
| 51 |
.. [ |
| 52 |
.. {"_key": "Hello World"}, |
| 53 |
.. {"_key": "Hello Groonga"} |
| 54 |
.. ] |
| 55 |
.. column_create \ |
| 56 |
.. --table Terms \ |
| 57 |
.. --name data_index \ |
| 58 |
.. --flags COLUMN_INDEX|WITH_POSITION \ |
| 59 |
.. --type Data \ |
| 60 |
.. --source _key |
| 61 |
.. truncate Terms.data_index |
| 62 |
.. load --table Data |
| 63 |
.. [ |
| 64 |
.. {"_key": "Good-by World"}, |
| 65 |
.. {"_key": "Good-by Groonga"} |
| 66 |
.. ] |
| 67 |
.. index_column_diff Terms data_index |
| 68 |
|
| 69 |
Parameters |
| 70 |
---------- |
| 71 |
|
| 72 |
This section describes all parameters. |
| 73 |
|
| 74 |
``table`` |
| 75 |
^^^^^^^^^ |
| 76 |
|
| 77 |
Specifies the name of a table include check target of the index column. |
| 78 |
|
| 79 |
``name`` |
| 80 |
^^^^^^^^ |
| 81 |
|
| 82 |
Specifies the name of check target of the index column. |
| 83 |
|
| 84 |
.. _index-column-diff-progress-log-level: |
| 85 |
|
| 86 |
``progress_log_level`` |
| 87 |
^^^^^^^^^^^^^^^^^^^^^^ |
| 88 |
|
| 89 |
.. versionadded:: 14.1.3 |
| 90 |
|
| 91 |
Specifies the log level of progress logs. |
| 92 |
|
| 93 |
The default log level is ``debug``. So you need to log all debug logs |
| 94 |
to see progress logs. |
| 95 |
|
| 96 |
If you use ``notice`` as a log level, you can see progress logs |
| 97 |
without other debug logs. See :ref:`log-level-level` for available log |
| 98 |
levels. |
| 99 |
|
| 100 |
The default is ``debug``. |
| 101 |
|
| 102 |
Example:: |
| 103 |
|
| 104 |
index_column_diff Terms data_index --progress_log_level notice |
| 105 |
|
| 106 |
Return value |
| 107 |
------------ |
| 108 |
|
| 109 |
``index_column_diff`` command returns result of check indexes:: |
| 110 |
|
| 111 |
[HEADER, CHECK_RESULT] |
| 112 |
|
| 113 |
``HEADER`` |
| 114 |
|
| 115 |
See :doc:`/reference/command/output_format` about ``HEADER``. |
| 116 |
|
| 117 |
``CHECK_RESULT`` |
| 118 |
|
| 119 |
This command returns the result of compression between the current |
| 120 |
value of the index column and the result of tokenize when this command |
| 121 |
execute as below:: |
| 122 |
|
| 123 |
{ |
| 124 |
"token": { |
| 125 |
"id": TOKEN_ID, |
| 126 |
"value": TOKEN_VALUE |
| 127 |
}, |
| 128 |
"remains": [ |
| 129 |
{ |
| 130 |
"record_id": RECORD_ID |
| 131 |
} |
| 132 |
], |
| 133 |
"missings": [ |
| 134 |
{ |
| 135 |
"record_id": RECORD_ID, |
| 136 |
"position": POSITION |
| 137 |
} |
| 138 |
] |
| 139 |
} |
| 140 |
|
| 141 |
If there are something in ``remains``, a token that Groonga |
| 142 |
was supposed to delete is remaining in a index. |
| 143 |
|
| 144 |
If there are something in ``missing``, a token that Groonga |
| 145 |
is supposing to remain in a index has been deleted from the index. |
| 146 |
|
| 147 |
``index_column_diff`` returns nothing as below when indexes haven't broken:: |
| 148 |
|
| 149 |
index_column_diff --table table --name index_column |
| 150 |
[[0,0.0,0.0],[]] |
| 151 |
|
| 152 |
``TOKEN_ID`` |
| 153 |
^^^^^^^^^^^^ |
| 154 |
|
| 155 |
``TOKEN_ID`` is id of a broken token. |
| 156 |
|
| 157 |
``TOKEN_VALUE`` |
| 158 |
^^^^^^^^^^^^^^^ |
| 159 |
|
| 160 |
``TOKEN_VALUE`` is value of a broken token. |
| 161 |
|
| 162 |
``RECORD_ID`` |
| 163 |
^^^^^^^^^^^^^ |
| 164 |
|
| 165 |
``RECORD_ID`` is id of a record include a broken token. |
| 166 |
|
| 167 |
``POSITION`` |
| 168 |
^^^^^^^^^^^^ |
| 169 |
|
| 170 |
``POSITION`` is appearing position of a broken token. |