Kouhei Sutou
null+****@clear*****
Fri Mar 18 19:21:03 JST 2016
Kouhei Sutou 2016-03-18 19:21:03 +0900 (Fri, 18 Mar 2016) New Revision: 3552c2c49612048d6fca279ddb9bfc94da7ed55b https://github.com/groonga/groonga/commit/3552c2c49612048d6fca279ddb9bfc94da7ed55b Message: doc: document logical_table_remove Added files: doc/source/example/reference/commands/logical_table_remove/basic_usage_create_shards.log doc/source/example/reference/commands/logical_table_remove/basic_usage_list_shards_after.log doc/source/example/reference/commands/logical_table_remove/basic_usage_list_shards_before.log doc/source/example/reference/commands/logical_table_remove/basic_usage_remove_all.log doc/source/example/reference/commands/logical_table_remove/remove_parts_create_shards.log doc/source/example/reference/commands/logical_table_remove/remove_parts_dump.log doc/source/example/reference/commands/logical_table_remove/remove_parts_remove.log doc/source/example/reference/commands/logical_table_remove/remove_with_for_shard_configm.log doc/source/example/reference/commands/logical_table_remove/remove_with_for_shard_create.log doc/source/example/reference/commands/logical_table_remove/remove_with_for_shard_remove.log doc/source/example/reference/commands/logical_table_remove/remove_with_reference_confirm.log doc/source/example/reference/commands/logical_table_remove/remove_with_reference_create.log doc/source/example/reference/commands/logical_table_remove/remove_with_reference_default.log doc/source/example/reference/commands/logical_table_remove/remove_with_reference_dependent.log doc/source/example/reference/commands/logical_table_remove/usage_register.log Modified files: doc/locale/ja/LC_MESSAGES/reference.po doc/source/reference/commands/logical_table_remove.rst Modified: doc/locale/ja/LC_MESSAGES/reference.po (+431 -19) =================================================================== --- doc/locale/ja/LC_MESSAGES/reference.po 2016-03-18 18:23:52 +0900 (a313e17) +++ doc/locale/ja/LC_MESSAGES/reference.po 2016-03-18 19:21:03 +0900 (4a6ca3f) @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 1.2.1\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2016-03-18 18:22+0900\n" +"PO-Revision-Date: 2016-03-18 19:20+0900\n" "Last-Translator: Masafumi Yokoyama <yokoyama �� clear-code.com>\n" "Language-Team: Japanese\n" "Language: ja\n" @@ -7172,9 +7172,431 @@ msgstr "" msgid "``logical_table_remove``" msgstr "" +msgid "" +"``logical_table_remove`` removes tables and their columns for the specified " +"logical table. If there are one or more indexes against key of the tables " +"and their columns, they are also removed." +msgstr "" +"``logical_table_remove`` は指定した論理テーブルのテーブルとそのカラムを削除し" +"ます。もし、テーブルのキーあるいはそのテーブルのカラムにインデックスが張って" +"ある場合はそれらも削除します。" + +msgid "" +"If you specify the part of a shard, table of the shard isn't removed. " +"``logical_table_remove`` just deletes records in the table." +msgstr "" +"シャードの一部を指定すると、そのシャードのテーブルは削除しません。テーブル内" +"のレコードを削除するだけです。" + +msgid "For example, there are the following records in a table:" +msgstr "例えば、テーブル内に以下のレコードがあるとします。" + +msgid "Record1: ``2016-03-18 00:30:00``" +msgstr "レコード1: ``2016-03-18 00:30:00``" + +msgid "Record2: ``2016-03-18 01:00:00``" +msgstr "レコード2: ``2016-03-18 01:00:00``" + +msgid "Record3: ``2016-03-18 02:00:00``" +msgstr "レコード3: ``2016-03-18 02:00:00``" + +msgid "" +"``logical_table_remove`` deletes \"Record1\" and \"Record2\" when you " +"specify range as between ``2016-03-18 00:00:00`` and ``2016-03-18 " +"01:30:00``. ``logical_table_remove`` doesn't delete \"Record3\". " +"``logical_table_remove`` doesn't remove the table." +msgstr "" +"範囲として ``2016-03-18 00:00:00`` から ``2016-03-18 01:30:00`` までを指定す" +"ると、「レコード1」と「レコード2」を削除します。「レコード3」は削除しません。" +"テーブルも削除しません。" + +msgid "" +"You can also remove tables and columns that reference the target table and " +"tables related with the target shard by using ``dependent`` parameter." +msgstr "" +"``dependent`` パラメーターを使うと、対象テーブルを参照しているテーブル・カラ" +"ムと対象シャードに関連しているテーブルも一緒に削除できます。" + +msgid "You specify logical table name and shard key what you want to remove." +msgstr "削除したい論理テーブル名とシャードキーを指定します。" + +msgid "This section describes about the followings:" +msgstr "このセクションでは次のことについて説明します。" + +msgid "Basic usage" +msgstr "基本的な使い方" + +msgid "Removes parts of a logical table" +msgstr "論理テーブルの一部を削除" + +msgid "Unremovable cases" +msgstr "削除できないケース" + +msgid "Removes with related tables" +msgstr "関連するテーブルと一緒に削除" + +msgid "Decreases used resources" +msgstr "利用リソースの削減" + +msgid "Register ``sharding`` plugin to use this command in advance." +msgstr "この コマンドを使うには事前に ``sharding`` プラグインを登録します。" + +msgid "" +"You can remove all tables for the logical table by specifying only " +"``logical_table`` and ``shard_key``." +msgstr "" +"``logical_table`` と ``shard_key`` だけを指定することで対象論理テーブル用のす" +"べてのテーブルを削除できます。" + +msgid "Here are commands to create 2 shards:" +msgstr "以下は2つのシャードを作成するコマンドです。" + +msgid "You can confirm existing shards by :doc:`logical_shard_list`:" +msgstr "存在するシャードは :doc:`logical_shard_list` で確認できます。" + +msgid "You can remove all shards:" +msgstr "すべてのシャードを削除できます。" + +msgid "There are no shards after you remove all shards:" +msgstr "すべてのシャードを削除した後はシャードは存在しません。" + +# 1e3c30ee4f62480c94f728efe9801121 +msgid "You can specify range of shards by the following parameters:" +msgstr "次のパラメーターでシャードの範囲を指定できます。" + +msgid "" +"See the following documents of :doc:`logical_select` for each parameter:" +msgstr "" +"各パラメーターについては :doc:`logical_select` の以下のドキュメントを参照して" +"ください。" + +msgid ":ref:`logical-select-min`" +msgstr "" + +msgid ":ref:`logical-select-min-border`" +msgstr "" + +msgid ":ref:`logical-select-max`" +msgstr "" + +msgid ":ref:`logical-select-max-border`" +msgstr "" + +msgid "" +"If the specified range doesn't cover all records in a shard, table for the " +"shard isn't removed. Target records in the table are only deleted." +msgstr "" +"指定した範囲がシャード内のすべてのレコードを含んでいなかったら、そのシャード" +"のテーブルは削除しません。テーブル内の対象レコードのみ削除します。" + +msgid "" +"If the specified range covers all records in a shard, table for the shard is " +"removed." +msgstr "" +"指定した範囲がシャード内のすべてのレコードを含んでいれば、そのシャード用の" +"テーブルを削除します。" + +msgid "" +"Here is a logical table to show the behavior. The logical table has two " +"shards:" +msgstr "" +"以下はこの挙動を示すための論理テーブルです。この論理テーブルには2つのシャード" +"があります。" + +msgid "There are the following records in ``Logs_20160318`` table:" +msgstr "``Logs_20160318`` テーブルには次のレコードがあります。" + +msgid "Record1: ``\"2016-03-18 00:30:00\"``" +msgstr "レコード1: ``\"2016-03-18 00:30:00\"``" + +msgid "Record2: ``\"2016-03-18 01:00:00\"``" +msgstr "レコード2: ``\"2016-03-18 01:00:00\"``" + +msgid "Record3: ``\"2016-03-18 02:00:00\"``" +msgstr "レコード3: ``\"2016-03-18 02:00:00\"``" + +msgid "There are the following records in ``Logs_20160319`` table:" +msgstr "``Logs_20160319`` テーブルには次のレコードがあります。" + +msgid "Record1: ``\"2016-03-19 00:30:00\"``" +msgstr "レコード1: ``\"2016-03-19 00:30:00\"``" + +msgid "Record2: ``\"2016-03-19 01:00:00\"``" +msgstr "レコード2: ``\"2016-03-19 01:00:00\"``" + +msgid "" +"The following range doesn't cover \"Record1\" in ``Logs_20160318`` table but " +"covers all records in ``Logs_20160319`` table:" +msgstr "" +"次の範囲は ``Logs_20160318`` テーブル内の「レコード1」を含んでいませんが、 " +"``Logs_20160319`` テーブルのすべてのレコードを含んでいます。" + +msgid "Parameter" +msgstr "パラメーター" + +msgid "``\"2016-03-18 01:00:00\"``" +msgstr "" + +msgid "``\"include\"``" +msgstr "" + +msgid "``\"2016-03-19 01:30:00\"``" +msgstr "" + +msgid "" +"``logical_table_remove`` with the range deletes \"Record2\" and \"Record3\" " +"in ``Logs_20160318`` table but doesn't remove ``Logs_20160318`` table. " +"Because there is \"Record1\" in ``Logs_20160318`` table." +msgstr "" +"この範囲を指定した ``logical_table_remove`` は ``Logs_20160318`` テーブルの" +"「レコード2」と「レコード3」を削除します。しかし、 ``Logs_20160318`` テーブル" +"は削除しません。なぜなら、 ``Logs_20160318`` テーブルには「レコード1」がある" +"からです。" + +msgid "" +"``logical_table_remove`` with the range removes ``Logs_20160319`` table " +"because the range covers all records in ``Logs_20160319`` table." +msgstr "" +"この範囲を指定した ``logical_table_remove`` は ``Logs_20160319`` テーブルを削" +"除します。なぜなら、この範囲は ``Logs_20160319`` テーブルのすべてのレコードを" +"含んでいるからです。" + +msgid "Here is an example to use ``logical_table_remove`` with the range:" +msgstr "この範囲を指定した ``logical_table_remove`` を使う例です。" + +msgid ":doc:`dump` shows that there is \"Record1\" in ``Logs_20160318`` table:" +msgstr "" +":doc:`dump` を使うと ``Logs_20160318`` テーブルに「レコード1」があることを確" +"認できます。" + +msgid "" +"There are some unremovable cases. See :ref:`table-remove-unremovable-cases` " +"for details. Because ``logical_table_remove`` uses the same checks." +msgstr "" +"いくつか削除できない場合があります。詳細は :ref:`table-remove-unremovable-" +"cases` を参照してください。なぜなら ``logical_table_remove`` も同じように" +"チェックしているからです。" + +msgid "" +"If you understand what you'll do, you can also remove tables and columns " +"that depend on the target shard with one ``logical_table_remove`` command by " +"using ``--dependent yes`` parameter." +msgstr "" +"もし、自分がなにをしようとしているかちゃんと理解しているのであれば、 ``--" +"dependent yes`` パラメーターを使うことで1回の ``logical_table_remove`` で対象" +"シャードに依存しているテーブルとカラムも削除することができます。" + +msgid "" +"Here are conditions for dependent. If table or column satisfies one of the " +"conditions, the table or column depends on the target shard:" +msgstr "" +"以下が依存していると判断する条件です。もし、テーブル・カラムがこれらの条件の" +"どれか1つでも満たしていてれば、そのテーブル・カラムは対象シャードに依存してい" +"ます。" + +# 10e63c2a9052442fbfca25373f30d1db +msgid "Tables and columns that reference the target shard" +msgstr "対象シャードを参照しているテーブル・カラム" + +msgid "" +"Tables for the shard (= The table has the same ``_YYYYMMDD`` postfix as the " +"target shard and is referenced from the target shard)" +msgstr "" +"対象シャード用のテーブル(= 名前の末尾が対象シャードと同じ ``_YYYYMMDD`` で、" +"対象シャードが参照しているテーブル)" + +msgid "" +"If there are one or more tables and columns that reference the target shard, " +"``logical_table_remove`` is failed. It's for avoiding dangling references." +msgstr "" +"対象シャードを参照しているテーブル・カラムが1つ以上あれば、 " +"``logical_table_remove`` は失敗します。これは、参照先がなくなることを防ぐため" +"です。" + +msgid "" +"``Bookmarks.log_20160320`` column in the following is the column that " +"references the target shard:" +msgstr "" +"以下の ``Bookmarks.log_20160320`` カラムは対象シャードを参照しています。" + +msgid "" +"You can't remove ``Logs_20160320`` by ``logical_table_remove`` by default:" +msgstr "" +"デフォルトでは ``logical_table_remove`` で ``Logs_20160320`` を削除できませ" +"ん。" + +msgid "" +"You can remove ``Logs_20160320`` by ``logical_table_remove`` with ``--" +"dependent yes`` parameter. ``Bookmarks.log_20160320`` is also removed:" +msgstr "" +"``--dependent yes`` パラメーター付きの ``logical_table_remove`` では " +"``Logs_20160320`` を削除できます。 ``Bookmarks.log_20160320`` も一緒に削除し" +"ます。" + +msgid "" +":doc:`object_exist` shows that ``Logs_20160320`` table and ``Bookmarks." +"log_20160320`` column are removed:" +msgstr "" +":doc:`object_exist` で ``Logs_20160320`` テーブルと ``Bookmarks." +"log_20160320`` カラムが削除されていることを確認できます。" + +msgid "" +"If there is one or more tables for the target shard, " +"``logical_table_remove`` with ``--dependent yes`` also removes them. Tables " +"that have the same ``_YYYYMMDD`` postfix as the target shard are treated as " +"tables for the target shard." +msgstr "" +"対象シャード用のテーブルが1つ以上ある場合、 ``--dependent yes`` 付きの " +"``logical_table_remove`` はそれらも一緒に削除します。 対象シャード用のテーブ" +"ルかどうかは対象シャードと同じ ``_YYYYMMDD`` がテーブル名の末尾にあるかどうか" +"で判断します。" + +msgid "" +"Here are two tables that have ``_20160320`` postfix. ``NotRelated_20160320`` " +"table isn't used by ``Logs_20160320`` table. ``Users_20160320`` table is " +"used by ``Logs_20160320`` table. ``Servers`` table exists and used by " +"``Logs_20160320`` table:" +msgstr "" +"末尾が ``_20160320`` のテーブルは2つあります。 ``NotRelated_20160320`` テーブ" +"ルは ``Logs_20160320`` テーブルから使われていません。 ``Users_20160320`` テー" +"ブルは ``Logs_20160320`` テーブルが使っています。 ``Servers`` テーブルもあ" +"り、これは ``Logs_20160320`` テーブルが使っています。" + +msgid "" +"``logical_table_remove`` with ``--dependent yes`` parameter removes only " +"``Logs_20160320`` table and ``Users_20160320`` table. Because " +"``Users_20160320`` table has ``_20160320`` postfix and used by " +"``Logs_20160320``. ``NotRelated_20160320`` table and ``Servers`` table " +"aren't removed. Because ``NotRelated_20160320`` table has ``_20160320`` " +"postfix but isn't used by ``Logs_20160320``. ``Servers`` table is used by " +"``Logs_20160320`` but doesn't have ``_20160320`` postfix:" +msgstr "" +"``--dependent yes`` パラメーター付きの``logical_table_remove`` は " +"``Logs_20160320`` テーブルと ``Users_20160320`` テーブルだけ削除します。なぜ" +"なら、 ``Users_20160320`` テーブルは名前の末尾が ``_20160320`` で、 " +"``Logs_20160320`` テーブルが使っているからです。 ``NotRelated_20160320`` テー" +"ブルと ``Servers`` テーブルは削除しません。なぜなら、 " +"``NotRelated_20160320`` は名前の末尾が ``_20160320`` ですが、 " +"``Logs_20160320`` テーブルは使っていないからです。 ``Servers`` テーブルは " +"``Logs_20160320`` テーブルが使っていますが、名前の末尾は ``_20160320`` ではあ" +"りません。" + +msgid "" +"You can confirm that ``Logs_20160320`` table and ``Users_20160320`` table " +"are removed but ``NotRelated_20160320`` table and ``Servers`` table aren't " +"removed:" +msgstr "" +"``Logs_20160320`` テーブルと ``Users_20160320`` テーブルは削除されていて、 " +"``NotRelated_20160320`` テーブルと ``Servers`` テーブルは削除されていないこと" +"を確認します。" + +msgid "" +"You can decrease resources for this command. See :ref:`table-remove-" +"decreases-used-resources` for details. Because ``logical_table_remove`` uses " +"the same logic as :doc:`table_remove`." +msgstr "" +"このコマンドが使うリソースを削減できます。詳細は :ref:`table-remove-" +"decreases-used-resources` を参照してください。なぜなら " +"``logical_table_remove`` は :doc:`table_remove` と同じロジックを使っているか" +"らです。" + msgid "This section describes parameters of ``logical_table_remove``." msgstr "このセクションでは ``logical_table_remove`` の引数について説明します。" +# fa7a11d06cb843b9a2b8d6e6f7d0d491 +msgid "" +"Specifies logical table name. It means table name without ``_YYYYMMDD`` " +"postfix. If you use actual table such as ``Logs_20150203``, " +"``Logs_20150203`` and so on, logical table name is ``Logs``." +msgstr "" +"論理テーブル名を指定します。これは \"_YYYYMMDD\" をテーブル名から除いたもので" +"す。実際のテーブルが \"Logs_20150203\" や \"Logs_20150203\" といったものな" +"ら、論理テーブル名は \"Logs\" です。" + +# d383cb1889334034b283ca5b0328c4da +msgid "See also :ref:`logical-select-logical-table`." +msgstr ":ref:`logical-select-logical-table` も参照してください。" + +# 9ac6056030d54374967cb7da463effd0 +msgid "Specifies column name which is treated as shared key." +msgstr "シャードキーとして使うカラム名を指定します。" + +# 6fabf6b56acb42afaf75505e2836d4c6 +msgid "See also :ref:`logical-select-logical-shard-key`." +msgstr ":ref:`logical-select-logical-shard-key` も参照してください。" + +# e72f9592d753446bb1e45421a97439ca +msgid "Specifies the minimum value of ``shard_key`` column." +msgstr "``shard_key`` カラムの最小値を指定します。" + +# d383cb1889334034b283ca5b0328c4da +msgid "See also :ref:`logical-select-min`." +msgstr ":ref:`logical-select-min` も参照してください。" + +# 4e29f7d070594734bd7f42f2b2a1951f +msgid "" +"Specifies whether the minimum value is included or not. ``include`` and " +"``exclude`` are available. The default is ``include``." +msgstr "" +"最小値を含めるかどうかを指定します。 ``include`` か ``exclude`` を指定しま" +"す。デフォルトは ``include`` です。" + +# d383cb1889334034b283ca5b0328c4da +msgid "See also :ref:`logical-select-min-border`." +msgstr ":ref:`logical-select-min-border` も参照してください。" + +# 47f8edb9debd47ada3b8892fcf0189b2 +msgid "Specifies the maximum value of ``shard_key`` column." +msgstr "``shard_key`` カラムの最大値を指定します。" + +# d383cb1889334034b283ca5b0328c4da +msgid "See also :ref:`logical-select-max`." +msgstr ":ref:`logical-select-max` も参照してください。" + +# a475a66f07f34738b25d1f0d71deb232 +msgid "" +"Specifies whether the maximum value is included or not. ``include`` and " +"``exclude`` are available. The default is ``include``." +msgstr "" +"最大値を含めるかどうかを指定します。 ``include`` か ``exclude`` を指定しま" +"す。デフォルトは ``include`` です。" + +# d383cb1889334034b283ca5b0328c4da +msgid "See also :ref:`logical-select-max-border`." +msgstr ":ref:`logical-select-max-border` も参照してください。" + +msgid "``dependent``" +msgstr "" + +# 10e63c2a9052442fbfca25373f30d1db +msgid "" +"Specifies whether tables and columns that depend on the target shard are " +"also removed or not." +msgstr "" +"対象シャードに依存しているテーブル・カラムも一緒に削除するかどうかを指定しま" +"す。" + +msgid "" +"If this value is ``yes``, tables and columns that depend on the target shard " +"are also removed. Otherwise, they aren't removed. If there are one or more " +"tables that reference the target shard, an error is returned. If there are " +"tables for the shared, they are not touched." +msgstr "" +"``yes`` を指定した場合は、対象シャードに依存しているテーブル・カラムも削除し" +"ます。 ``yes`` を指定しなければ削除しません。もし、対象シャードを参照している" +"テーブル・カラムが1つ以上あればエラーになります。もし、対象シャード用のテーブ" +"ルがあっても、それらを削除しません。" + +msgid "You should use this parameter carefully. This is a danger parameter." +msgstr "このパラメーターは注意して使ってください。危険なパラメーターです。" + +msgid "" +"See :ref:`logical-table-remove-removes-with-related-tables` how to use this " +"parameter." +msgstr "" +"このパラメーターの使い方は :ref:`logical-table-remove-removes-with-related-" +"tables` を参照してください。" + msgid "``normalize``" msgstr "" @@ -12248,6 +12670,14 @@ msgstr "" "す。" msgid "" +"You can also remove tables and columns that reference the target table by " +"using ``dependent`` parameter." +msgstr "" +"もし、自分がなにをしようとしているかちゃんと理解しているのであれば、 ``--" +"dependent yes`` パラメーターを使うことで1回の ``table_remove`` で対象テーブル" +"を参照しているテーブルとカラムも削除することができます。" + +msgid "" "You just specify table name that you want to remove. ``table_remove`` " "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." @@ -12257,22 +12687,10 @@ msgstr "" "ラムにインデックスが張ってある場合は、張ってあるすべてのインデックスも削除し" "ます。" -msgid "This section describes about the followings:" -msgstr "このセクションでは次のことについて説明します。" - -msgid "Basic usage" -msgstr "基本的な使い方" - -msgid "Unremovable cases" -msgstr "削除できないケース" - # 10e63c2a9052442fbfca25373f30d1db msgid "Removes a table with tables and columns that reference the target table" msgstr "対象テーブルを参照しているテーブル・カラムも一緒に削除" -msgid "Decreases used resources" -msgstr "利用リソースの削減" - msgid "Let's think about the following case:" msgstr "次のケースを考えてみましょう。" @@ -12472,9 +12890,6 @@ msgid "See :ref:`table-remove-usage` how to use this parameter." msgstr "" "このパラメーターの使い方は :ref:`table-remove-usage` を参照してください。" -msgid "``dependent``" -msgstr "" - # 10e63c2a9052442fbfca25373f30d1db msgid "" "Specifies whether tables and columns that reference the target table are " @@ -12497,9 +12912,6 @@ msgstr "" "言い換えると、デフォルトでは、対象テーブルを参照しているテーブル・カラムが1つ" "でもあると、対象テーブルを削除しません。" -msgid "You should use this parameter carefully. This is a danger parameter." -msgstr "このパラメーターは注意して使ってください。危険なパラメーターです。" - msgid "See :ref:`table-remove-remove-dependents` how to use this parameter." msgstr "" "このパラメーターの使い方は :ref:`table-remove-remove-dependents` を参照してく" Added: doc/source/example/reference/commands/logical_table_remove/basic_usage_create_shards.log (+10 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/logical_table_remove/basic_usage_create_shards.log 2016-03-18 19:21:03 +0900 (2da5052) @@ -0,0 +1,10 @@ +Execution example:: + + table_create Logs_20160318 TABLE_NO_KEY + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create Logs_20160318 timestamp COLUMN_SCALAR Time + # [[0, 1337566253.89858, 0.000355720520019531], true] + table_create Logs_20160319 TABLE_NO_KEY + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create Logs_20160319 timestamp COLUMN_SCALAR Time + # [[0, 1337566253.89858, 0.000355720520019531], true] Added: doc/source/example/reference/commands/logical_table_remove/basic_usage_list_shards_after.log (+4 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/logical_table_remove/basic_usage_list_shards_after.log 2016-03-18 19:21:03 +0900 (d8e8bda) @@ -0,0 +1,4 @@ +Execution example:: + + logical_shard_list --logical_table Logs + # [[0, 1337566253.89858, 0.000355720520019531], []] Added: doc/source/example/reference/commands/logical_table_remove/basic_usage_list_shards_before.log (+18 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/logical_table_remove/basic_usage_list_shards_before.log 2016-03-18 19:21:03 +0900 (0ed8ad5) @@ -0,0 +1,18 @@ +Execution example:: + + logical_shard_list --logical_table Logs + # [ + # [ + # 0, + # 1337566253.89858, + # 0.000355720520019531 + # ], + # [ + # { + # "name": "Logs_20160318" + # }, + # { + # "name": "Logs_20160319" + # } + # ] + # ] Added: doc/source/example/reference/commands/logical_table_remove/basic_usage_remove_all.log (+6 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/logical_table_remove/basic_usage_remove_all.log 2016-03-18 19:21:03 +0900 (73f0fec) @@ -0,0 +1,6 @@ +Execution example:: + + logical_table_remove \ + --logical_table Logs \ + --shard_key timestamp + # [[0, 1337566253.89858, 0.000355720520019531], true] Added: doc/source/example/reference/commands/logical_table_remove/remove_parts_create_shards.log (+23 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/logical_table_remove/remove_parts_create_shards.log 2016-03-18 19:21:03 +0900 (edd1e08) @@ -0,0 +1,23 @@ +Execution example:: + + table_create Logs_20160318 TABLE_NO_KEY + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create Logs_20160318 timestamp COLUMN_SCALAR Time + # [[0, 1337566253.89858, 0.000355720520019531], true] + load --table Logs_20160318 + [ + {"timestamp": "2016-03-18 00:30:00"}, + {"timestamp": "2016-03-18 01:00:00"}, + {"timestamp": "2016-03-18 02:00:00"} + ] + # [[0, 1337566253.89858, 0.000355720520019531], 3] + table_create Logs_20160319 TABLE_NO_KEY + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create Logs_20160319 timestamp COLUMN_SCALAR Time + # [[0, 1337566253.89858, 0.000355720520019531], true] + load --table Logs_20160319 + [ + {"timestamp": "2016-03-19 00:30:00"}, + {"timestamp": "2016-03-19 01:00:00"} + ] + # [[0, 1337566253.89858, 0.000355720520019531], 2] Added: doc/source/example/reference/commands/logical_table_remove/remove_parts_dump.log (+13 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/logical_table_remove/remove_parts_dump.log 2016-03-18 19:21:03 +0900 (428e79d) @@ -0,0 +1,13 @@ +Execution example:: + + dump + # plugin_register sharding + # + # table_create Logs_20160318 TABLE_NO_KEY + # column_create Logs_20160318 timestamp COLUMN_SCALAR Time + # + # load --table Logs_20160318 + # [ + # ["_id","timestamp"], + # [1,1458228600.0] + # ] Added: doc/source/example/reference/commands/logical_table_remove/remove_parts_remove.log (+10 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/logical_table_remove/remove_parts_remove.log 2016-03-18 19:21:03 +0900 (8e5577d) @@ -0,0 +1,10 @@ +Execution example:: + + logical_table_remove \ + --logical_table Logs \ + --shard_key timestamp \ + --min "2016-03-18 01:00:00" \ + --min_border "include" \ + --max "2016-03-19 01:30:00" \ + --max_border "include" + # [[0, 1337566253.89858, 0.000355720520019531], true] Added: doc/source/example/reference/commands/logical_table_remove/remove_with_for_shard_configm.log (+10 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/logical_table_remove/remove_with_for_shard_configm.log 2016-03-18 19:21:03 +0900 (86b9afe) @@ -0,0 +1,10 @@ +Execution example:: + + object_exist Logs_20160320 + # [[0, 1337566253.89858, 0.000355720520019531], false] + object_exist Users_20160320 + # [[0, 1337566253.89858, 0.000355720520019531], false] + object_exist NotRelated_20160320 + # [[0, 1337566253.89858, 0.000355720520019531], true] + object_exist Servers + # [[0, 1337566253.89858, 0.000355720520019531], true] Added: doc/source/example/reference/commands/logical_table_remove/remove_with_for_shard_create.log (+16 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/logical_table_remove/remove_with_for_shard_create.log 2016-03-18 19:21:03 +0900 (33c80be) @@ -0,0 +1,16 @@ +Execution example:: + + table_create NotRelated_20160320 TABLE_PAT_KEY ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + table_create Users_20160320 TABLE_PAT_KEY ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + table_create Servers TABLE_PAT_KEY ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + table_create Logs_20160320 TABLE_NO_KEY + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create Logs_20160320 timestamp COLUMN_SCALAR Time + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create Logs_20160320 user COLUMN_SCALAR Users_20160320 + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create Logs_20160320 server COLUMN_SCALAR Servers + # [[0, 1337566253.89858, 0.000355720520019531], true] Added: doc/source/example/reference/commands/logical_table_remove/remove_with_for_shard_remove.log (+7 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/logical_table_remove/remove_with_for_shard_remove.log 2016-03-18 19:21:03 +0900 (80f9a62) @@ -0,0 +1,7 @@ +Execution example:: + + logical_table_remove \ + --logical_table Logs \ + --shard_key timestamp \ + --dependent yes + # [[0, 1337566253.89858, 0.000355720520019531], true] Added: doc/source/example/reference/commands/logical_table_remove/remove_with_reference_confirm.log (+6 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/logical_table_remove/remove_with_reference_confirm.log 2016-03-18 19:21:03 +0900 (1a309bd) @@ -0,0 +1,6 @@ +Execution example:: + + object_exist Logs_20160320 + # [[0, 1337566253.89858, 0.000355720520019531], false] + object_exist Bookmarks.log_20160320 + # [[0, 1337566253.89858, 0.000355720520019531], false] Added: doc/source/example/reference/commands/logical_table_remove/remove_with_reference_create.log (+10 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/logical_table_remove/remove_with_reference_create.log 2016-03-18 19:21:03 +0900 (7098eb6) @@ -0,0 +1,10 @@ +Execution example:: + + table_create Logs_20160320 TABLE_NO_KEY + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create Logs_20160320 timestamp COLUMN_SCALAR Time + # [[0, 1337566253.89858, 0.000355720520019531], true] + table_create Bookmarks TABLE_HASH_KEY ShortText + # [[0, 1337566253.89858, 0.000355720520019531], true] + column_create Bookmarks log_20160320 COLUMN_SCALAR Logs_20160320 + # [[0, 1337566253.89858, 0.000355720520019531], true] Added: doc/source/example/reference/commands/logical_table_remove/remove_with_reference_default.log (+20 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/logical_table_remove/remove_with_reference_default.log 2016-03-18 19:21:03 +0900 (01882da) @@ -0,0 +1,20 @@ +Execution example:: + + logical_table_remove \ + --logical_table Logs \ + --shard_key timestamp + # [ + # [ + # -2, + # 1337566253.89858, + # 0.000355720520019531, + # "operation not permitted: <[table][remove] a column that references the table exists: <Bookmarks.log_20160320> -> <Logs_20160320", + # [ + # [ + # "Groonga::Sharding::LogicalTableRemoveCommand.remove_table", + # "/home/kou/work/c/groonga.clean/plugins/sharding/logical_table_remove.rb", + # 80 + # ] + # ] + # ] + # ] Added: doc/source/example/reference/commands/logical_table_remove/remove_with_reference_dependent.log (+7 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/logical_table_remove/remove_with_reference_dependent.log 2016-03-18 19:21:03 +0900 (80f9a62) @@ -0,0 +1,7 @@ +Execution example:: + + logical_table_remove \ + --logical_table Logs \ + --shard_key timestamp \ + --dependent yes + # [[0, 1337566253.89858, 0.000355720520019531], true] Added: doc/source/example/reference/commands/logical_table_remove/usage_register.log (+4 -0) 100644 =================================================================== --- /dev/null +++ doc/source/example/reference/commands/logical_table_remove/usage_register.log 2016-03-18 19:21:03 +0900 (78608b8) @@ -0,0 +1,4 @@ +Execution example:: + + register sharding + # [[0, 1337566253.89858, 0.000355720520019531], true] Modified: doc/source/reference/commands/logical_table_remove.rst (+382 -19) =================================================================== --- doc/source/reference/commands/logical_table_remove.rst 2016-03-18 18:23:52 +0900 (8de0d14) +++ doc/source/reference/commands/logical_table_remove.rst 2016-03-18 19:21:03 +0900 (3e0f5c9) @@ -17,7 +17,29 @@ Summary .. versionadded:: 5.0.5 -TODO +``logical_table_remove`` removes tables and their columns for the +specified logical table. If there are one or more indexes against key +of the tables and their columns, they are also removed. + +If you specify the part of a shard, table of the shard isn't +removed. ``logical_table_remove`` just deletes records in the table. + +For example, there are the following records in a table: + + * Record1: ``2016-03-18 00:30:00`` + * Record2: ``2016-03-18 01:00:00`` + * Record3: ``2016-03-18 02:00:00`` + +``logical_table_remove`` deletes "Record1" and "Record2" when you +specify range as between ``2016-03-18 00:00:00`` and ``2016-03-18 +01:30:00``. ``logical_table_remove`` doesn't delete +"Record3". ``logical_table_remove`` doesn't remove the table. + +.. versionadded:: 6.0.1 + + You can also remove tables and columns that reference the target + table and tables related with the target shard by using + ``dependent`` parameter. Syntax ------ @@ -28,15 +50,300 @@ The required parameters are ``logical_table`` and ``shard_key``:: logical_table_remove logical_table shard_key - [min] - [min_border] - [max] - [max_border] + [min=null] + [min_border="include"] + [max=null] + [max_border="include"] + [dependent=no] + +.. _logical-table-remove-usage: Usage ----- -TODO +You specify logical table name and shard key what you want to remove. + +This section describes about the followings: + + * Basic usage + * Removes parts of a logical table + * Unremovable cases + * Removes with related tables + * Decreases used resources + +.. _logical-table-remove-basic-usage: + +Basic usage +^^^^^^^^^^^ + +Register ``sharding`` plugin to use this command in advance. + +.. groonga-command +.. include:: ../../example/reference/commands/logical_table_remove/usage_register.log +.. register sharding + +You can remove all tables for the logical table by specifying only +``logical_table`` and ``shard_key``. + +Here are commands to create 2 shards: + +.. groonga-command +.. include:: ../../example/reference/commands/logical_table_remove/basic_usage_create_shards.log +.. table_create Logs_20160318 TABLE_NO_KEY +.. column_create Logs_20160318 timestamp COLUMN_SCALAR Time +.. +.. table_create Logs_20160319 TABLE_NO_KEY +.. column_create Logs_20160319 timestamp COLUMN_SCALAR Time + +You can confirm existing shards by :doc:`logical_shard_list`: + +.. groonga-command +.. include:: ../../example/reference/commands/logical_table_remove/basic_usage_list_shards_before.log +.. logical_shard_list --logical_table Logs + +You can remove all shards: + +.. groonga-command +.. include:: ../../example/reference/commands/logical_table_remove/basic_usage_remove_all.log +.. logical_table_remove \ +.. --logical_table Logs \ +.. --shard_key timestamp + +There are no shards after you remove all shards: + +.. groonga-command +.. include:: ../../example/reference/commands/logical_table_remove/basic_usage_list_shards_after.log +.. logical_shard_list --logical_table Logs + +.. _logical-table-remove-removes-parts: + +Removes parts of a logical table +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +You can specify range of shards by the following parameters: + + * ``min`` + * ``min_border`` + * ``max`` + * ``max_border`` + +See the following documents of :doc:`logical_select` for each +parameter: + + * :ref:`logical-select-min` + * :ref:`logical-select-min-border` + * :ref:`logical-select-max` + * :ref:`logical-select-max-border` + +If the specified range doesn't cover all records in a shard, table for +the shard isn't removed. Target records in the table are only deleted. + +If the specified range covers all records in a shard, table for the +shard is removed. + +Here is a logical table to show the behavior. The logical table has two +shards: + +.. groonga-command +.. include:: ../../example/reference/commands/logical_table_remove/remove_parts_create_shards.log +.. table_create Logs_20160318 TABLE_NO_KEY +.. column_create Logs_20160318 timestamp COLUMN_SCALAR Time +.. load --table Logs_20160318 +.. [ +.. {"timestamp": "2016-03-18 00:30:00"}, +.. {"timestamp": "2016-03-18 01:00:00"}, +.. {"timestamp": "2016-03-18 02:00:00"} +.. ] +.. +.. table_create Logs_20160319 TABLE_NO_KEY +.. column_create Logs_20160319 timestamp COLUMN_SCALAR Time +.. load --table Logs_20160319 +.. [ +.. {"timestamp": "2016-03-19 00:30:00"}, +.. {"timestamp": "2016-03-19 01:00:00"} +.. ] + +There are the following records in ``Logs_20160318`` table: + + * Record1: ``"2016-03-18 00:30:00"`` + * Record2: ``"2016-03-18 01:00:00"`` + * Record3: ``"2016-03-18 02:00:00"`` + +There are the following records in ``Logs_20160319`` table: + + * Record1: ``"2016-03-19 00:30:00"`` + * Record2: ``"2016-03-19 01:00:00"`` + +The following range doesn't cover "Record1" in ``Logs_20160318`` table +but covers all records in ``Logs_20160319`` table: + +.. list-table:: + :header-rows: 1 + + * - Parameter + - Value + * - ``min`` + - ``"2016-03-18 01:00:00"`` + * - ``min_border`` + - ``"include"`` + * - ``max`` + - ``"2016-03-19 01:30:00"`` + * - ``max_border`` + - ``"include"`` + +``logical_table_remove`` with the range deletes "Record2" and +"Record3" in ``Logs_20160318`` table but doesn't remove +``Logs_20160318`` table. Because there is "Record1" in +``Logs_20160318`` table. + +``logical_table_remove`` with the range removes ``Logs_20160319`` +table because the range covers all records in ``Logs_20160319`` table. + +Here is an example to use ``logical_table_remove`` with the range: + +.. groonga-command +.. include:: ../../example/reference/commands/logical_table_remove/remove_parts_remove.log +.. logical_table_remove \ +.. --logical_table Logs \ +.. --shard_key timestamp \ +.. --min "2016-03-18 01:00:00" \ +.. --min_border "include" \ +.. --max "2016-03-19 01:30:00" \ +.. --max_border "include" + +:doc:`dump` shows that there is "Record1" in ``Logs_20160318`` table: + +.. groonga-command +.. include:: ../../example/reference/commands/logical_table_remove/remove_parts_dump.log +.. dump + +.. _logical-table-remove-unremovable-cases: + +Unremovable cases +^^^^^^^^^^^^^^^^^ + +There are some unremovable cases. See +:ref:`table-remove-unremovable-cases` for details. Because +``logical_table_remove`` uses the same checks. + +.. _logical-table-remove-removes-with-related-tables: + +Removes with related tables +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. versionadded:: 6.0.1 + +If you understand what you'll do, you can also remove tables and +columns that depend on the target shard with one +``logical_table_remove`` command by using ``--dependent yes`` +parameter. + +Here are conditions for dependent. If table or column satisfies one of +the conditions, the table or column depends on the target shard: + + * Tables and columns that reference the target shard + * Tables for the shard (= The table has the same ``_YYYYMMDD`` + postfix as the target shard and is referenced from the target + shard) + +If there are one or more tables and columns that reference the target +shard, ``logical_table_remove`` is failed. It's for avoiding dangling +references. + +``Bookmarks.log_20160320`` column in the following is the column that +references the target shard: + +.. groonga-command +.. include:: ../../example/reference/commands/logical_table_remove/remove_with_reference_create.log +.. table_create Logs_20160320 TABLE_NO_KEY +.. column_create Logs_20160320 timestamp COLUMN_SCALAR Time +.. +.. table_create Bookmarks TABLE_HASH_KEY ShortText +.. column_create Bookmarks log_20160320 COLUMN_SCALAR Logs_20160320 + +You can't remove ``Logs_20160320`` by ``logical_table_remove`` by +default: + +.. groonga-command +.. include:: ../../example/reference/commands/logical_table_remove/remove_with_reference_default.log +.. logical_table_remove \ +.. --logical_table Logs \ +.. --shard_key timestamp + +You can remove ``Logs_20160320`` by ``logical_table_remove`` with +``--dependent yes`` parameter. ``Bookmarks.log_20160320`` is also +removed: + +.. groonga-command +.. include:: ../../example/reference/commands/logical_table_remove/remove_with_reference_dependent.log +.. logical_table_remove \ +.. --logical_table Logs \ +.. --shard_key timestamp \ +.. --dependent yes + +:doc:`object_exist` shows that ``Logs_20160320`` table and +``Bookmarks.log_20160320`` column are removed: + +.. groonga-command +.. include:: ../../example/reference/commands/logical_table_remove/remove_with_reference_confirm.log +.. object_exist Logs_20160320 +.. object_exist Bookmarks.log_20160320 + +If there is one or more tables for the target shard, +``logical_table_remove`` with ``--dependent yes`` also removes +them. Tables that have the same ``_YYYYMMDD`` postfix as the target +shard are treated as tables for the target shard. + +Here are two tables that have ``_20160320`` +postfix. ``NotRelated_20160320`` table isn't used by ``Logs_20160320`` +table. ``Users_20160320`` table is used by ``Logs_20160320`` +table. ``Servers`` table exists and used by ``Logs_20160320`` table: + +.. groonga-command +.. include:: ../../example/reference/commands/logical_table_remove/remove_with_for_shard_create.log +.. table_create NotRelated_20160320 TABLE_PAT_KEY ShortText +.. table_create Users_20160320 TABLE_PAT_KEY ShortText +.. table_create Servers TABLE_PAT_KEY ShortText +.. table_create Logs_20160320 TABLE_NO_KEY +.. column_create Logs_20160320 timestamp COLUMN_SCALAR Time +.. column_create Logs_20160320 user COLUMN_SCALAR Users_20160320 +.. column_create Logs_20160320 server COLUMN_SCALAR Servers + +``logical_table_remove`` with ``--dependent yes`` parameter removes +only ``Logs_20160320`` table and ``Users_20160320`` table. Because +``Users_20160320`` table has ``_20160320`` postfix and used by +``Logs_20160320``. ``NotRelated_20160320`` table and ``Servers`` table +aren't removed. Because ``NotRelated_20160320`` table has +``_20160320`` postfix but isn't used by ``Logs_20160320``. ``Servers`` +table is used by ``Logs_20160320`` but doesn't have ``_20160320`` +postfix: + +.. groonga-command +.. include:: ../../example/reference/commands/logical_table_remove/remove_with_for_shard_remove.log +.. logical_table_remove \ +.. --logical_table Logs \ +.. --shard_key timestamp \ +.. --dependent yes + +You can confirm that ``Logs_20160320`` table and ``Users_20160320`` +table are removed but ``NotRelated_20160320`` table and ``Servers`` +table aren't removed: + +.. groonga-command +.. include:: ../../example/reference/commands/logical_table_remove/remove_with_for_shard_configm.log +.. object_exist Logs_20160320 +.. object_exist Users_20160320 +.. object_exist NotRelated_20160320 +.. object_exist Servers + +.. _logical-table-remove-decreases-used-resources: + +Decreases used resources +^^^^^^^^^^^^^^^^^^^^^^^^ + +You can decrease resources for this command. See +:ref:`table-remove-decreases-used-resources` for details. Because +``logical_table_remove`` uses the same logic as :doc:`table_remove`. Parameters ---------- @@ -46,51 +353,107 @@ This section describes parameters of ``logical_table_remove``. Required parameters ^^^^^^^^^^^^^^^^^^^ -There are required parameters, ``logical_table`` and ``shard_key``. +There are required parameters. + +.. _logical-table-remove-logical-table: ``logical_table`` """"""""""""""""" -Specifies logical table name. It means table name without "_YYYYMMDD" postfix. -If you use actual table such as "Logs_20150203", "Logs_20150203" and so on, logical table name is "Logs". +Specifies logical table name. It means table name without +``_YYYYMMDD`` postfix. If you use actual table such as +``Logs_20150203``, ``Logs_20150203`` and so on, logical table name is +``Logs``. + +See also :ref:`logical-select-logical-table`. + +.. _logical-table-remove-shard-key: ``shard_key`` """"""""""""" -Specifies column name which is treated as shared key in each parted table. +Specifies column name which is treated as shared key. + +See also :ref:`logical-select-logical-shard-key`. Optional parameters ^^^^^^^^^^^^^^^^^^^ There are optional parameters. +.. _logical-table-remove-min: + ``min`` """"""" -Specifies the min value of ``shard_key`` +Specifies the minimum value of ``shard_key`` column. + +See also :ref:`logical-select-min`. + +.. _logical-table-remove-min-border: ``min_border`` """""""""""""" -Specifies whether the min value of borderline must be include or not. -Specify ``include`` or ``exclude`` as the value of this parameter. +Specifies whether the minimum value is included or not. ``include`` +and ``exclude`` are available. The default is ``include``. + +See also :ref:`logical-select-min-border`. + +.. _logical-table-remove-max: ``max`` """"""" -Specifies the max value of ``shard_key``. +Specifies the maximum value of ``shard_key`` column. + +See also :ref:`logical-select-max`. + +.. _logical-table-remove-max-border: ``max_border`` """""""""""""" -Specifies whether the max value of borderline must be include or not. -Specify ``include`` or ``exclude`` as the value of this parameter. +Specifies whether the maximum value is included or not. ``include`` +and ``exclude`` are available. The default is ``include``. + +See also :ref:`logical-select-max-border`. + +.. _logical-table-remove-dependent: + +``dependent`` +""""""""""""" + +.. versionadded:: 6.0.1 + +Specifies whether tables and columns that depend on the target shard +are also removed or not. + +Here are conditions for dependent. If table or column satisfies one of +the conditions, the table or column depends on the target shard: + + * Tables and columns that reference the target shard + * Tables for the shard (= The table has the same ``_YYYYMMDD`` + postfix as the target shard and is referenced from the target + shard) + +If this value is ``yes``, tables and columns that depend on the target +shard are also removed. Otherwise, they aren't removed. If there are +one or more tables that reference the target shard, an error is +returned. If there are tables for the shared, they are not touched. + +You should use this parameter carefully. This is a danger parameter. + +See :ref:`logical-table-remove-removes-with-related-tables` how to use +this parameter. Return value ------------ -TODO - -:: +The command returns ``true`` as body on success such as:: [HEADER, true] + +If the command fails, error details are in ``HEADER``. + +See :doc:`/reference/command/output_format` for ``HEADER``. -------------- next part -------------- HTML����������������������������... Download