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