YUKI Hiroshi
null+****@clear*****
Tue Mar 22 19:53:26 JST 2016
YUKI Hiroshi 2016-03-22 19:53:26 +0900 (Tue, 22 Mar 2016) New Revision: 402b1d79b7738c35268d940ee941a57da0a65231 https://github.com/groonga/groonga/commit/402b1d79b7738c35268d940ee941a57da0a65231 Message: Revert "Describe "table_remove" with more meaningful examples" This reverts commit 242250d3f9a8fe3f13ba8347b25c0aafd27b878f. Modified files: doc/source/example/reference/commands/table_remove/remove_dependents_default.log doc/source/example/reference/commands/table_remove/remove_dependents_schema.log doc/source/example/reference/commands/table_remove/remove_dependents_yes.log doc/source/example/reference/commands/table_remove/unremovable_cases_key_type_create.log doc/source/example/reference/commands/table_remove/unremovable_cases_key_type_remove_fail.log doc/source/example/reference/commands/table_remove/unremovable_cases_key_type_remove_success.log doc/source/example/reference/commands/table_remove/unremovable_cases_value_type_create.log doc/source/example/reference/commands/table_remove/unremovable_cases_value_type_remove_fail.log doc/source/example/reference/commands/table_remove/unremovable_cases_value_type_remove_success.log doc/source/reference/commands/table_remove.rst Modified: doc/source/example/reference/commands/table_remove/remove_dependents_default.log (+2 -2) =================================================================== --- doc/source/example/reference/commands/table_remove/remove_dependents_default.log 2016-03-22 19:04:50 +0900 (eb4d5df) +++ doc/source/example/reference/commands/table_remove/remove_dependents_default.log 2016-03-22 19:53:26 +0900 (3639ead) @@ -1,12 +1,12 @@ Execution example:: - table_remove UserId + table_remove ReferencedTable # [ # [ # -2, # 1337566253.89858, # 0.000355720520019531, - # "[table][remove] a table that references the table exists: <AdminUser._key> -> <UserId>", + # "[table][remove] a table that references the table exists: <Table1._key> -> <ReferencedTable>", # [ # [ # "is_removable_table", Modified: doc/source/example/reference/commands/table_remove/remove_dependents_schema.log (+4 -4) =================================================================== --- doc/source/example/reference/commands/table_remove/remove_dependents_schema.log 2016-03-22 19:04:50 +0900 (3e8129d) +++ doc/source/example/reference/commands/table_remove/remove_dependents_schema.log 2016-03-22 19:53:26 +0900 (463ecf1) @@ -1,10 +1,10 @@ Execution example:: - table_create UserId TABLE_HASH_KEY ShortText + table_create ReferencedTable TABLE_HASH_KEY ShortText # [[0, 1337566253.89858, 0.000355720520019531], true] - table_create AdminUser TABLE_HASH_KEY UserId + table_create Table1 TABLE_HASH_KEY ReferencedTable # [[0, 1337566253.89858, 0.000355720520019531], true] - table_create GeneralUser TABLE_NO_KEY + table_create Table2 TABLE_NO_KEY # [[0, 1337566253.89858, 0.000355720520019531], true] - column_create GeneralUser id COLUMN_SCALAR UserId + column_create Table2 reference_column COLUMN_SCALAR ReferencedTable # [[0, 1337566253.89858, 0.000355720520019531], true] Modified: doc/source/example/reference/commands/table_remove/remove_dependents_yes.log (+1 -1) =================================================================== --- doc/source/example/reference/commands/table_remove/remove_dependents_yes.log 2016-03-22 19:04:50 +0900 (5aaf9b6) +++ doc/source/example/reference/commands/table_remove/remove_dependents_yes.log 2016-03-22 19:53:26 +0900 (352a6db) @@ -1,4 +1,4 @@ Execution example:: - table_remove UserId --dependent yes + table_remove ReferencedTable --dependent yes # [[0, 1337566253.89858, 0.000355720520019531], true] Modified: doc/source/example/reference/commands/table_remove/unremovable_cases_key_type_create.log (+2 -2) =================================================================== --- doc/source/example/reference/commands/table_remove/unremovable_cases_key_type_create.log 2016-03-22 19:04:50 +0900 (c4698fc) +++ doc/source/example/reference/commands/table_remove/unremovable_cases_key_type_create.log 2016-03-22 19:53:26 +0900 (57d9e4a) @@ -1,6 +1,6 @@ Execution example:: - table_create UserId TABLE_HASH_KEY ShortText + table_create ReferencedByTable TABLE_HASH_KEY ShortText # [[0, 1337566253.89858, 0.000355720520019531], true] - table_create AdminUser TABLE_HASH_KEY UserId + table_create ReferenceTable TABLE_HASH_KEY ReferencedByTable # [[0, 1337566253.89858, 0.000355720520019531], true] Modified: doc/source/example/reference/commands/table_remove/unremovable_cases_key_type_remove_fail.log (+2 -2) =================================================================== --- doc/source/example/reference/commands/table_remove/unremovable_cases_key_type_remove_fail.log 2016-03-22 19:04:50 +0900 (eb4d5df) +++ doc/source/example/reference/commands/table_remove/unremovable_cases_key_type_remove_fail.log 2016-03-22 19:53:26 +0900 (6be7b00) @@ -1,12 +1,12 @@ Execution example:: - table_remove UserId + table_remove ReferencedByTable # [ # [ # -2, # 1337566253.89858, # 0.000355720520019531, - # "[table][remove] a table that references the table exists: <AdminUser._key> -> <UserId>", + # "[table][remove] a table that references the table exists: <ReferenceTable._key> -> <ReferencedByTable>", # [ # [ # "is_removable_table", Modified: doc/source/example/reference/commands/table_remove/unremovable_cases_key_type_remove_success.log (+2 -2) =================================================================== --- doc/source/example/reference/commands/table_remove/unremovable_cases_key_type_remove_success.log 2016-03-22 19:04:50 +0900 (57075cb) +++ doc/source/example/reference/commands/table_remove/unremovable_cases_key_type_remove_success.log 2016-03-22 19:53:26 +0900 (64711f5) @@ -1,6 +1,6 @@ Execution example:: - table_remove AdminUser + table_remove ReferenceTable # [[0, 1337566253.89858, 0.000355720520019531], true] - table_remove UserId + table_remove ReferencedByTable # [[0, 1337566253.89858, 0.000355720520019531], true] Modified: doc/source/example/reference/commands/table_remove/unremovable_cases_value_type_create.log (+3 -3) =================================================================== --- doc/source/example/reference/commands/table_remove/unremovable_cases_value_type_create.log 2016-03-22 19:04:50 +0900 (3de8d33) +++ doc/source/example/reference/commands/table_remove/unremovable_cases_value_type_create.log 2016-03-22 19:53:26 +0900 (bfc297e) @@ -1,8 +1,8 @@ Execution example:: - table_create UserId TABLE_HASH_KEY ShortText + table_create ReferencedByColumn TABLE_HASH_KEY ShortText # [[0, 1337566253.89858, 0.000355720520019531], true] - table_create GeneralUser TABLE_NO_KEY + table_create Table TABLE_NO_KEY # [[0, 1337566253.89858, 0.000355720520019531], true] - column_create GeneralUser id COLUMN_SCALAR UserId + column_create Table reference_column COLUMN_SCALAR ReferencedByColumn # [[0, 1337566253.89858, 0.000355720520019531], true] Modified: doc/source/example/reference/commands/table_remove/unremovable_cases_value_type_remove_fail.log (+2 -2) =================================================================== --- doc/source/example/reference/commands/table_remove/unremovable_cases_value_type_remove_fail.log 2016-03-22 19:04:50 +0900 (071e51d) +++ doc/source/example/reference/commands/table_remove/unremovable_cases_value_type_remove_fail.log 2016-03-22 19:53:26 +0900 (68c6360) @@ -1,12 +1,12 @@ Execution example:: - table_remove UserId + table_remove ReferencedByColumn # [ # [ # -2, # 1337566253.89858, # 0.000355720520019531, - # "[table][remove] a column that references the table exists: <GeneralUser.id> -> <ReferencedByColumn>", + # "[table][remove] a column that references the table exists: <Table.reference_column> -> <ReferencedByColumn>", # [ # [ # "is_removable_table", Modified: doc/source/example/reference/commands/table_remove/unremovable_cases_value_type_remove_success.log (+2 -2) =================================================================== --- doc/source/example/reference/commands/table_remove/unremovable_cases_value_type_remove_success.log 2016-03-22 19:04:50 +0900 (1bbdc3e) +++ doc/source/example/reference/commands/table_remove/unremovable_cases_value_type_remove_success.log 2016-03-22 19:53:26 +0900 (a7130e2) @@ -1,6 +1,6 @@ Execution example:: - column_remove GeneralUser id + column_remove Table reference_column # [[0, 1337566253.89858, 0.000355720520019531], true] - table_remove UserId + table_remove ReferencedByColumn # [[0, 1337566253.89858, 0.000355720520019531], true] Modified: doc/source/reference/commands/table_remove.rst (+58 -60) =================================================================== --- doc/source/reference/commands/table_remove.rst 2016-03-22 19:04:50 +0900 (4577a87) +++ doc/source/reference/commands/table_remove.rst 2016-03-22 19:53:26 +0900 (26d0300) @@ -17,10 +17,8 @@ removed. .. versionadded:: 6.0.1 - This command removes tables and columns recursively, with the - ``dependent`` parameter. If you specify ``--dependent yes``, - then other tables and columns depending on the disappearing table - are also removed recursively. + You can also remove tables and columns that reference the target + table by using ``dependent`` parameter. Syntax ------ @@ -36,15 +34,15 @@ Usage ----- You just specify table name that you want to remove. ``table_remove`` -removes the specified table and its columns. If the table and its -columns are indexed, all index columns for the table and its columns -are also removed. +removes the table and its columns. If the table and its columns are +indexed, all index columns for the table and its columns are also +removed. This section describes about the followings: * Basic usage * Unremovable cases - * Recursive removing of tables and columns + * Removes a table with tables and columns that reference the target table * Decreases used resources .. _table-remove-basic-usage: @@ -89,8 +87,8 @@ Let's confirm the current schema before running ``table_remove``: .. include:: ../../example/reference/commands/table_remove/basic_usage_dump_before_table_remove.log .. dump -If you remove the ``Entries`` table, the following tables and columns -are removed: +If you remove ``Entries`` table, the following tables and columns are +removed: * ``Entries`` * ``Entries.title`` @@ -98,7 +96,7 @@ are removed: * ``EntryKeys.key_index`` * ``Terms.content_index`` -The following tables (lexicons) are left: +The following tables (lexicons) aren't removed: * ``EntryKeys`` * ``Terms`` @@ -121,102 +119,102 @@ Here is schema after ``table_remove``. Only ``EntryKeys`` and Unremovable cases ^^^^^^^^^^^^^^^^^ -You cannot remove a table, if there is any other table or column -depending on it. In other words, any table satisfying one or more -following conditions is unremovable. +There are some unremovable cases: + + * One or more tables use the table as key type. + * One or more columns use the table as value type. - * One or more tables use the table as their key type. - * One or more columns use the table as their value type. +Both cases blocks dangling references. If the table is referenced as +type and the table is removed, tables and columns that refer the table +are broken. -To avoid breaking of left tables with missing references, -``table_remove`` fails for such a depended (referenced) table. +If the target table satisfies one of them, ``table_remove`` is +failed. The target table and its columns aren't removed. -Here is an example for a table which is used as key type. +Here is an example for the table is used as key type case. -The following commands create a table ``UserId`` going to be removed -and another table ``AdminUser` depending on the first table via its key -type: +The following commands create a table to be removed and a table that +uses the table to be removed as key type: .. groonga-command .. include:: ../../example/reference/commands/table_remove/unremovable_cases_key_type_create.log -.. table_create UserId TABLE_HASH_KEY ShortText -.. table_create AdminUser TABLE_HASH_KEY UserId +.. table_create ReferencedByTable TABLE_HASH_KEY ShortText +.. table_create ReferenceTable TABLE_HASH_KEY ReferencedByTable -``table_remove`` against ``UserId`` fails: +``table_remove`` against ``ReferencedByTable`` is failed: .. groonga-command .. include:: ../../example/reference/commands/table_remove/unremovable_cases_key_type_remove_fail.log -.. table_remove UserId +.. table_remove ReferencedByTable -You need to remove ``AdminUser`` before ``UserId``: +You need to remove ``ReferenceTable`` before you remove +``ReferencedByTable``: .. groonga-command .. include:: ../../example/reference/commands/table_remove/unremovable_cases_key_type_remove_success.log -.. table_remove AdminUser -.. table_remove UserId +.. table_remove ReferenceTable +.. table_remove ReferencedByTable -Here is another example for a table which is used as value type. +Here is an example for the table is used as value type case. -The following commands create a table ``UserId`` going to be removed -and another table ``GeneralUser`` with a column depending on the first -table via its value type: +The following commands create a table to be removed and a column that +uses the table to be removed as value type: .. groonga-command .. include:: ../../example/reference/commands/table_remove/unremovable_cases_value_type_create.log -.. table_create UserId TABLE_HASH_KEY ShortText -.. table_create GeneralUser TABLE_NO_KEY -.. column_create GeneralUser id COLUMN_SCALAR UserId +.. table_create ReferencedByColumn TABLE_HASH_KEY ShortText +.. table_create Table TABLE_NO_KEY +.. column_create Table reference_column COLUMN_SCALAR ReferencedByColumn -``table_remove`` against ``UserId`` fails: +``table_remove`` against ``ReferencedByColumn`` is failed: .. groonga-command .. include:: ../../example/reference/commands/table_remove/unremovable_cases_value_type_remove_fail.log -.. table_remove UserId +.. table_remove ReferencedByColumn -You need to remove ``GeneralUser.id`` before ``UserId``: +You need to remove ``Table.reference_column`` before you remove +``ReferencedByColumn``: .. groonga-command .. include:: ../../example/reference/commands/table_remove/unremovable_cases_value_type_remove_success.log -.. column_remove GeneralUser id -.. table_remove UserId +.. column_remove Table reference_column +.. table_remove ReferencedByColumn .. _table-remove-remove-dependents: -Recursive removing of tables and columns -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Removes a table with tables and columns that reference the target table +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. versionadded:: 6.0.1 -If you understand what you'll do, you can remove a table and other -tables depending on it together at a time, by the ``--dependent yes`` -parameter. +If you understand what you'll do, you can also remove tables and +columns that reference the target table with one ``table_remove`` +command by using ``--dependent yes`` parameter. -``UserId`` in the following schema is referenced from a table +``ReferencedTable`` in the following schema is referenced from a table and a column: .. groonga-command .. include:: ../../example/reference/commands/table_remove/remove_dependents_schema.log -.. table_create UserId TABLE_HASH_KEY ShortText -.. table_create AdminUser TABLE_HASH_KEY UserId -.. table_create GeneralUser TABLE_NO_KEY -.. column_create GeneralUser id COLUMN_SCALAR UserId +.. table_create ReferencedTable TABLE_HASH_KEY ShortText +.. table_create Table1 TABLE_HASH_KEY ReferencedTable +.. table_create Table2 TABLE_NO_KEY +.. column_create Table2 reference_column COLUMN_SCALAR ReferencedTable -You can't remove ``UserId`` by default: +You can't remove ``ReferencedTable`` by default: .. groonga-command .. include:: ../../example/reference/commands/table_remove/remove_dependents_default.log -.. table_remove UserId +.. table_remove ReferencedTable -Additional parameter ``--dependent yes`` for the command line allows -you to remove the ``UserId`` table, then both ``AdminUser`` and -``GeneralUser.id`` depending on the ``UserId`` are also removed at a -time: +You can remove ``ReferencedTable``, ``Table1`` and +``Table2.reference_column`` by using ``--dependent yes`` +parameter. ``Table1`` and ``Table2.reference_column`` reference +``ReferencedTable``: .. groonga-command .. include:: ../../example/reference/commands/table_remove/remove_dependents_yes.log -.. table_remove UserId --dependent yes - -After all, only the independent ``GeneralUser`` table is left. +.. table_remove ReferencedTable --dependent yes .. _table-remove-decreases-used-resources: -------------- next part -------------- HTML����������������������������...Download