16.1.3 Optional functions of the adbidxrebuild command
The adbidxrebuild command provides the following optional functions:
-
Re-execute facility
-
Inheritance of index creation processing from the adbimport command
- Organization of this subsection
(1) Re-execute facility
When the adbidxrebuild command is re-executed after having terminated abnormally, it resumes the index rebuild processing from the location where the index contents are guaranteed from the previous session of index rebuild processing. This reduces the amount of time required for re-execution of index rebuild processing.
Use of the re-execute facility is appropriate when the following conditions are satisfied:
-
The indexes to be rebuilt include one of the following types of indexes:#
-
B-tree index defined for a single-chunk table
-
Text index defined for a single-chunk table
-
Index defined for a multi-chunk table
- #
-
If an index for the table to be processed is deleted by using the DROP INDEX statement before the adbidxrebuild command is re-executed, the deleted index will not be rebuilt. In addition, if all indexes to be rebuilt are deleted before the adbidxrebuild command is re-executed, only command termination processing is performed.
-
-
The processing stopped for one of the following reasons:
-
The adbidxrebuild command terminated abnormally.
-
The adbidxrebuild command was terminated forcibly by the adbcancel command.
-
The HADB server was terminated forcibly by the adbstop --force command.
-
The server process was terminated forcibly by the OS's kill command or because of a power outage.
-
In the following cases, even if the above conditions are satisfied, the re-execute facility is not applied (index rebuild processing is forcibly re-executed from the beginning):
-
The adbidxrebuild command is executed with the --force option specified.
-
After the adbimport command is stopped, the adbidxrebuild command that was executed with the --force option specified is canceled.
-
An error occurred during execution of the adbunarchivechunk command.
The conditions under which the re-execute facility is applied and the processing that is performed during command re-execution depend on whether CHUNK was specified in the definition of the target table, which contains the indexes to be rebuilt. That is, the conditions and processing depend on whether the target table is a single-chunk table or multi-chunk table.
- If the target table is a single-chunk table
-
In index rebuild processing, table data is retrieved and range indexes are rebuilt first, and then B-tree and text indexes are rebuilt.
If the adbidxrebuild command is re-executed after retrieval of the table's data has been completed (and the KFAA80233-I message has been issued, indicating that retrieval of the table's data has been completed), the re-execute facility is applied and index rebuild processing restarts with rebuilding of B-tree and text indexes
Figure 16‒4: Overview of the re-execute facility for a single-chunk table Note that the re-execute facility is not applied in the following cases:
-
Only range indexes have been rebuilt.
-
The adbidxrebuild command was canceled while table data was being retrieved (before the KFAA80233-I message was issued).
-
The adbidxrebuild command was executed with the --create-temp-file option specified.
-
- If the target table is a multi-chunk table
-
If the target table is a multi-chunk table, the index rebuild processing is performed for each chunk.
Therefore, if the adbidxrebuild command is re-executed after processing on a multi-chunk table stops, the re-execute facility is applied. Thus, the index rebuild processing restarts with the chunk for which processing was underway when the previous command's execution was canceled.
Note that if the adbidxrebuild command was stopped while it was retrieving table data from the first chunk (before the first instance of the KFAA80233-I was issued), the re-execute facility is not applied.
Figure 16‒5: Overview of the re-execute facility for a multi-chunk table If the following three conditions are satisfied, index rebuild processing restarts from the point of rebuilding B-tree and text indexes in the chunk where the previous processing was canceled:
-
The indexes to be rebuilt include B-tree or text indexes.
-
All table data has been retrieved from the chunk where the previous processing was canceled (when retrieval of table data from a chunk is completed, the KFAA80233-I message is issued).
-
The adbidxrebuild command was executed without the --create-temp-file option specified (if the adbidxrebuild command was executed with the --create-temp-file option specified, index rebuild processing restarts from the point of retrieving table data in the chunk where the previous processing was canceled).
Figure 16‒6: Restarting from rebuilding of B-tree and text indexes in the chunk where the previous processing was canceled -
(2) Inheriting index creation processing from the adbimport command
The adbidxrebuild command can inherit index creation processing from the adbimport command.
If you execute the adbidxrebuild command because the adbimport command could not be executed for any of the following reasons, the adbidxrebuild command inherits index creation processing:#
-
No temporary work file exists (the KFAA50247-E message is issued during re-execution of the adbimport command).
If the temporary work file is deleted while the adbimport command is stopped, the adbimport command cannot be re-executed. In such a case, executing the adbidxrebuild command with the --create-temp-file option specified inherits index creation processing from the adbimport command.
-
No command status file (a file under the $DBDIR/ADBSYS/ADBUTL directory) exists (the KFAA50244-E message is issued during re-execution of the adbimport command).
If an attempt is made to delete the command status file while the adbimport command is stopped, the adbimport command cannot be re-executed. In such a case, executing the adbidxrebuild command with the --force option specified inherits index creation processing from the adbimport command.
-
An index is defined while the adbimport command is stopped, and as a result, an index in unfinished status is created in the table to be imported (the KFAA50209-E message is issued during re-execution of the adbimport command).
If an index is defined while the adbimport command is stopped, you might not be able to re-execute the adbimport command. In such a case, executing the adbidxrebuild command with the --force option specified inherits index creation processing from the adbimport command.
- #
-
If an index for the table to be processed is deleted by using the DROP INDEX statement before the adbidxrebuild command is executed, the deleted index will not be rebuilt. In addition, if all indexes being created are deleted before the adbidxrebuild command is executed, only command termination processing is performed.
Processing by the adbidxrebuild command differs depending on the option specified for it.
- ■ If the adbidxrebuild command is executed with the --create-temp-file option specified
-
If you execute the adbidxrebuild command with the --create-temp-file option specified, the adbidxrebuild command starts with retrieval of table data for which a temporary work file is to be created.
Figure 16‒7: Inheriting index creation processing from the adbimport command (with the --create-temp-file option specified) If the table to be processed is a multi-chunk table, the chunk that was being processed when the adbimport command was stopped becomes the processing target of the adbidxrebuild command. The target chunk is not changed until the adbidxrebuild command terminates normally.
- ■ If the adbidxrebuild command is executed with the --force option specified
-
If you execute the adbidxrebuild command with the --force option specified, the adbidxrebuild command starts with the beginning of index rebuild processing.
Figure 16‒8: Inheriting index creation processing from the adbimport command (with the --force option specified)