From dfb22dc62284c88d4ccd72b48815a06af637d375 Mon Sep 17 00:00:00 2001 From: Christian Haudum Date: Tue, 3 Feb 2015 11:12:03 +0100 Subject: [PATCH] updated crash version to 0.11.1 --- CHANGES.txt | 21 +++++ app/build.gradle | 2 +- docs/best_practice/cluster_upgrade.txt | 12 +-- docs/best_practice/data_import.txt | 30 +++---- docs/best_practice/migrating_from_mongodb.txt | 6 +- docs/blob.txt | 10 +-- docs/hello.txt | 4 +- docs/sql/aggregation.txt | 5 +- docs/sql/data_types.txt | 37 ++++---- docs/sql/ddl.txt | 86 +++++++++---------- docs/sql/dml.txt | 16 ++-- docs/sql/information_schema.txt | 5 +- docs/sql/occ.txt | 5 +- docs/sql/partitioned_tables.txt | 18 ++-- docs/sql/queries.txt | 2 +- docs/sql/refresh.txt | 2 +- docs/sql/system.txt | 13 +-- docs/src/crate/tests.py | 40 ++++++--- docs/versions.cfg | 20 ++++- 19 files changed, 193 insertions(+), 141 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 0c0a49e5dd79..fd5d225035d7 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -5,6 +5,27 @@ Changes for Crate Unreleased ========== + - Updated crash version to 0.11.1 which contains following changes: + + - added ``--format`` command line option + to support different response output formats such as + ``tabular``, ``raw``, ``json``, ``csv`` and ``mixed`` + + - BREAKING CHANGE + the ``CONNECT `` client command was changed to ``\connect `` + see documentation for further details + + - alternative cli implementation using prompt_toolkit + + - added coloured printing when in interactive shell + + - Fix: Filtering on a routing column sometimes didn't work if the value was an + empty string + + - Fix: Bulk inserts with mixed but compatible types (e.g. int and long) failed + + - Fix: Force UTF8 encoding in file reading collector to avoid JVM's default encoding settings + - Added support for the ``std_dev``, ``variance`` and ``geometric_mean`` aggregation functions diff --git a/app/build.gradle b/app/build.gradle index 469b4a15c137..5c286ce60f1f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -97,7 +97,7 @@ distZip { ext { downloadDir = new File(buildDir, 'downloads') plugin_crateadmin_version = '0.11.2' - crash_version = '0.10.3' + crash_version = '0.11.1' } evaluationDependsOn(':es') diff --git a/docs/best_practice/cluster_upgrade.txt b/docs/best_practice/cluster_upgrade.txt index 1554bdf5bf9c..d733f6aecb59 100644 --- a/docs/best_practice/cluster_upgrade.txt +++ b/docs/best_practice/cluster_upgrade.txt @@ -100,7 +100,7 @@ Use the :ref:`ref-set` command to do so: .. code-block:: psql cr> SET GLOBAL TRANSIENT cluster.routing.allocation.enable = 'new_primaries'; - SET OK (... sec) + SET OK, ... .. note:: @@ -217,11 +217,11 @@ look: ... FROM information_schema.tables ... WHERE number_of_replicas = 0 and schema_name in ('blob', 'doc') ... ORDER BY schema, "table" ; - +--------+-------------------+ - | schema | table | - +--------+-------------------+ + +--------+------...+ + | schema | table...| + +--------+------...+ ... - +--------+-------------------+ + +--------+------...+ SELECT ... rows in set (... sec) @@ -277,7 +277,7 @@ allocations again that have been disabled in the first step: .. code-block:: psql cr> SET GLOBAL TRANSIENT cluster.routing.allocation.enable = 'all'; - SET OK (... sec) + SET OK, ... .. warning:: diff --git a/docs/best_practice/data_import.txt b/docs/best_practice/data_import.txt index f100807e03b0..867eae915515 100644 --- a/docs/best_practice/data_import.txt +++ b/docs/best_practice/data_import.txt @@ -40,12 +40,12 @@ By default you would probably create the table like that:: ... country STRING ... ) ... ); - CREATE OK (... sec) + CREATE OK, ... .. hide: cr> DROP TABLE user; - DROP OK (... sec) + DROP OK, ... Well, there's nothing wrong with that and does its job, but it is not very performant either and therefore not what we want to use in a real world @@ -102,7 +102,7 @@ The ``CREATE TABLE`` statement now looks like:: ... ) ... ) CLUSTERED INTO 12 shards ... WITH (number_of_replicas = 0); - CREATE OK (... sec) + CREATE OK, ... .. seealso:: @@ -121,12 +121,12 @@ minimise the overhead during the import. :: cr> ALTER TABLE user SET (refresh_interval = 0); - ALTER OK (... sec) + ALTER OK, ... .. hide: cr> DROP TABLE user; - DROP OK (... sec) + DROP OK, ... It is also possible to set the refresh interval already in the ``CREATE TABLE`` statement:: @@ -145,14 +145,14 @@ in the ``CREATE TABLE`` statement:: ... number_of_replicas = 0, ... refresh_interval = 0 ... ); - CREATE OK (... sec) + CREATE OK, ... Once the import is finished you can set the refresh interval to a reasonable value (time in ms):: cr> ALTER TABLE user SET (refresh_interval = 1000); - ALTER OK (... sec) + ALTER OK, ... .. seealso:: @@ -172,14 +172,14 @@ completely by setting the ``indices.store.throttle.type`` to ``none``. :: cr> SET GLOBAL TRANSIENT indices.store.throttle.type = 'none'; - SET OK (... sec) + SET OK, ... However if you still want to throttle the merging of segments during import you can increase the maximum bytes per second from its default of ``20mb`` to something like 100-200mb/s for SSD disks:: cr> SET GLOBAL TRANSIENT indices.store.throttle.max_bytes_per_sec = '150mb'; - SET OK (... sec) + SET OK, ... After import you should not forget to turn throttling on again by setting its @@ -188,7 +188,7 @@ value to ``merge`` (default) or ``all``. :: cr> SET GLOBAL TRANSIENT indices.store.throttle.type = 'merge'; - SET OK (... sec) + SET OK, ... .. seealso:: @@ -226,7 +226,7 @@ COPY FROM Command .. hide: cr> REFRESH TABLE user; - REFRESH OK (... sec) + REFRESH OK, ... .. note:: @@ -252,7 +252,7 @@ For example:: .. hide: cr> REFRESH TABLE user; - REFRESH OK (... sec) + REFRESH OK, ... In our example it will not make a difference, but if you have a more complex data set with a lot of columns and large values, it probably makes sense to @@ -279,7 +279,7 @@ For example:: .. hide: cr> REFRESH TABLE user; - REFRESH OK (... sec) + REFRESH OK, ... Partitioned Tables ------------------ @@ -299,7 +299,7 @@ or the other column must lose its contraint. .. hide: cr> DROP TABLE user; - DROP OK (... sec) + DROP OK, ... :: @@ -315,7 +315,7 @@ or the other column must lose its contraint. ... ) CLUSTERED INTO 6 shards ... PARTITIONED BY (day_joined) ... WITH (number_of_replicas = 0); - CREATE OK (... sec) + CREATE OK, ... To import data into partitioned tables efficiently you will have to import each table partition separately. Since the value of the table partition is not diff --git a/docs/best_practice/migrating_from_mongodb.txt b/docs/best_practice/migrating_from_mongodb.txt index c7653159c833..e4f40dc96a00 100644 --- a/docs/best_practice/migrating_from_mongodb.txt +++ b/docs/best_practice/migrating_from_mongodb.txt @@ -48,7 +48,7 @@ A basic CREATE TABLE statement looks as follows:: ... name string, ... obj object (dynamic) ... ) clustered into 5 shards with (number_of_replicas = 0); - CREATE OK (... sec) + CREATE OK, ... In Crate each field is indexed by default. So it is not necessary to create any additional indices. @@ -61,7 +61,7 @@ off:: ... obj object (dynamic), ... dummy string INDEX OFF ... ) clustered into 5 shards with (number_of_replicas = 0); - CREATE OK (... sec) + CREATE OK, ... For fields that contain text consider using a full-text analyzer. This will enable great full-text search capabilities. See :ref:`indices_and_fulltext` for @@ -78,7 +78,7 @@ the table and also insert arbitrary objects into the obj column:: INSERT OK, 1 row affected (... sec) cr> refresh table mytable2; - REFRESH OK (... sec) + REFRESH OK, ... .. Hidden: wait for schema update so that newcol is available diff --git a/docs/blob.txt b/docs/blob.txt index 5cc5a1dc7521..d1d5d74392d7 100644 --- a/docs/blob.txt +++ b/docs/blob.txt @@ -16,7 +16,7 @@ Before adding blobs a ``blob table`` must be created. Lets use the crate shell ``crash`` to issue the SQL statement:: sh$ crash -c "create blob table myblobs clustered into 3 shards with (number_of_replicas=1)" - CREATE OK (... sec) + CREATE OK, ... Now crate is configured to allow blobs to be management under the ``/_blobs/myblobs`` endpoint. @@ -60,7 +60,7 @@ See :ref:`ref-create-blob-table` for details. Creating a blob table with a custom blob data path:: sh$ crash -c "create blob table myblobs clustered into 3 shards with (blobs_path='/tmp/crate_blob_data')" # doctest: +SKIP - CREATE OK (... sec) + CREATE OK, ... Altering a blob table @@ -70,7 +70,7 @@ The number of replicas a blob table has can be changed using the ``ALTER BLOB TABLE`` clause:: sh$ crash -c "alter blob table myblobs set (number_of_replicas=0)" - ALTER OK (... sec) + ALTER OK, ... Uploading ========= @@ -173,12 +173,12 @@ Deleting a blob table Blob tables can be deleted similar to normal tables (again using the crate shell here):: sh$ crash -c "drop blob table myblobs" - DROP OK (... sec) + DROP OK, ... .. Hidden: Re-create the blob table so information_schema will show it:: sh$ crash -c "create blob table myblobs clustered into 3 shards with (number_of_replicas=1)" - CREATE OK (... sec) + CREATE OK, ... .. _`binary large objects`: http://en.wikipedia.org/wiki/Binary_large_object diff --git a/docs/hello.txt b/docs/hello.txt index 60471b394280..801d87aab89c 100644 --- a/docs/hello.txt +++ b/docs/hello.txt @@ -15,7 +15,7 @@ the Crate distribution. First let's connect to a running node:: - cr> connect 127.0.0.1:4200; + cr> \connect 127.0.0.1:4200; +------------------------+-----------+---------+-----------+---------+ | server_url | node_name | version | connected | message | +------------------------+-----------+---------+-----------+---------+ @@ -34,7 +34,7 @@ the table ``tweets`` with all columns we need:: ... text string INDEX using fulltext, ... user_id string ... ); - CREATE OK (... sec) + CREATE OK, ... Now we are ready to insert our first tweet:: diff --git a/docs/sql/aggregation.txt b/docs/sql/aggregation.txt index b0fbdf550a86..c3339cf514a9 100644 --- a/docs/sql/aggregation.txt +++ b/docs/sql/aggregation.txt @@ -26,8 +26,7 @@ This aggregation function simply returns the number of rows that match the query `count(columName)` is also possible, but currently only works on a primary key column. The semantics are the same. -The return value is always of type ``long``. -:: +The return value is always of type ``long``:: cr> select count(*) from locations; +----------+ @@ -375,4 +374,4 @@ do. .. _Geometric Mean: https://en.wikipedia.org/wiki/Mean#Geometric_mean_.28GM.29 .. _Variance: https://en.wikipedia.org/wiki/Variance -.. _Standard Deviation: https://en.wikipedia.org/wiki/Standard_deviation \ No newline at end of file +.. _Standard Deviation: https://en.wikipedia.org/wiki/Standard_deviation diff --git a/docs/sql/data_types.txt b/docs/sql/data_types.txt index 1821cff18e33..36ca60ac33f4 100644 --- a/docs/sql/data_types.txt +++ b/docs/sql/data_types.txt @@ -22,12 +22,12 @@ A basic boolean type. Accepting ``true`` and ``false`` as values. Example:: cr> create table my_bool_table ( ... first_column boolean ... ); - CREATE OK (... sec) + CREATE OK, ... .. hide: cr> drop table my_bool_table; - DROP OK (... sec) + DROP OK, ... string @@ -38,7 +38,7 @@ A text-based basic type containing one or more characters. Example:: cr> create table my_table2 ( ... first_column string ... ); - CREATE OK (... sec) + CREATE OK, ... Columns of type string can also be analyzed. See :ref:`sql_ddl_index_fulltext`. @@ -59,7 +59,7 @@ Example:: ... fifth_column float, ... sixth_column byte ... ); - CREATE OK (... sec) + CREATE OK, ... ip @@ -74,7 +74,7 @@ Example:: ... fqdn string, ... ip_addr ip ... ); - CREATE OK (... sec) + CREATE OK, ... :: @@ -88,7 +88,6 @@ Example:: ... values ('localhost', 'not.a.real.ip'); SQLActionException[failed to parse [ip_addr]] - timestamp ========= @@ -105,7 +104,7 @@ fractions. Example:: ... id integer, ... first_column timestamp ... ); - CREATE OK (... sec) + CREATE OK, ... :: @@ -164,7 +163,7 @@ Create table example:: ... id integer primary key, ... pin geo_point ... ) with (number_of_replicas = 0) - CREATE OK (... sec) + CREATE OK, ... object @@ -197,12 +196,12 @@ Example:: ... ) ... ) ... ); - CREATE OK (... sec) + CREATE OK, ... .. hide: cr> drop table my_table11; - DROP OK (... sec) + DROP OK, ... strict ------ @@ -220,12 +219,12 @@ Example:: ... birthday timestamp ... ) ... ); - CREATE OK (... sec) + CREATE OK, ... .. hide: cr> drop table my_table12; - DROP OK (... sec) + DROP OK, ... dynamic ------- @@ -249,12 +248,12 @@ Examples:: ... birthday timestamp ... ) ... ); - CREATE OK (... sec) + CREATE OK, ... .. hide: cr> drop table my_table13; - DROP OK (... sec) + DROP OK, ... which is exactly the same as:: @@ -265,12 +264,12 @@ which is exactly the same as:: ... birthday timestamp ... ) ... ); - CREATE OK (... sec) + CREATE OK, ... .. hide: cr> drop table my_table14; - DROP OK (... sec) + DROP OK, ... New columns added to ``dynamic`` objects are, once added, usable as usual subcolumns. One can retrieve them, sort by them @@ -296,12 +295,12 @@ but otherwise ignore them. ... font_size float ... ) ... ); - CREATE OK (... sec) + CREATE OK, ... .. hide: cr> drop table my_table15; - DROP OK (... sec) + DROP OK, ... New columns added to ``ignored`` objects can be retrieved as result column in a ``SELECT`` statement, but one cannot order by them or use them in a where clause. They are simply there for fetching, @@ -386,7 +385,7 @@ Array types are defined as follows:: ... tags array(string), ... objects array(object as (age integer, name string)) ... ); - CREATE OK (... sec) + CREATE OK, ... .. note:: diff --git a/docs/sql/ddl.txt b/docs/sql/ddl.txt index b9643d784df3..d1ac7f9d5e49 100644 --- a/docs/sql/ddl.txt +++ b/docs/sql/ddl.txt @@ -19,12 +19,12 @@ Let's create a simple table with two columns of type ``integer`` and ``string``: ... first_column integer, ... second_column string ... ); - CREATE OK (... sec) + CREATE OK, ... A table can be removed by using the ``DROP TABLE`` command:: cr> drop table my_table; - DROP OK (... sec) + DROP OK, ... Schemas @@ -39,7 +39,7 @@ it will be created:: ... label string, ... position geo_point ... ); - CREATE OK (... sec) + CREATE OK, ... :: @@ -68,7 +68,7 @@ schema name. If the last table with that schema is dropped, the schema is gone (except for the ``blob`` and ``doc`` schema):: cr> drop table my_schema.my_table ; - DROP OK (... sec) + DROP OK, ... Every table that is created without an explicit schema name, will be created in the ``doc`` schema:: @@ -77,7 +77,7 @@ the ``doc`` schema:: ... a_column byte, ... another_one geo_point ... ); - CREATE OK (... sec) + CREATE OK, ... :: @@ -93,7 +93,7 @@ the ``doc`` schema:: .. hide: cr> drop table my_doc_table; - DROP OK (... sec) + DROP OK, ... .. _sql_ddl_naming_restrictions: @@ -137,7 +137,7 @@ the default routing value used for sharding. Example:: ... first_column integer primary key, ... second_column string ... ); - CREATE OK (... sec) + CREATE OK, ... Currently primary key's cannot be auto generated and have to be specified if data is inserted, otherwise an error is returned. @@ -149,7 +149,7 @@ Defining multiple columns with a primary key constraint is also supported:: ... second_column string primary key, ... third_column string ... ); - CREATE OK (... sec) + CREATE OK, ... Or using a alternate syntax:: @@ -159,7 +159,7 @@ Or using a alternate syntax:: ... third_column string, ... primary key (first_column, second_column) ... ); - CREATE OK (... sec) + CREATE OK, ... .. _sql_ddl_sharding: @@ -177,7 +177,7 @@ table creation. Example:: cr> create table my_table5 ( ... first_column int ... ) clustered into 10 shards; - CREATE OK (... sec) + CREATE OK, ... .. note:: @@ -195,7 +195,7 @@ statement and is used to route a row to a particular shard. Example:: ... first_column int, ... second_column string ... ) clustered by (first_column); - CREATE OK (... sec) + CREATE OK, ... If primary key constraints are defined, the routing column definition @@ -207,7 +207,7 @@ If the routing column is defined explicitly, it must match a primary key column: ... second_column string primary key, ... third_column string ... ) clustered by (first_column); - CREATE OK (... sec) + CREATE OK, ... Example for combining custom routing and shard definition:: @@ -217,7 +217,7 @@ Example for combining custom routing and shard definition:: ... second_column string primary key, ... third_column string ... ) clustered by (first_column) into 10 shards; - CREATE OK (... sec) + CREATE OK, ... .. _replication: @@ -240,7 +240,7 @@ Example:: ... first_column int, ... second_column string ... ) with (number_of_replicas = 1); - CREATE OK (... sec) + CREATE OK, ... The `number_of_replicas` property also accepts an string as parameter that @@ -288,12 +288,12 @@ Example:: ... title string, ... author string ... ) with (column_policy = 'strict'); - CREATE OK (... sec) + CREATE OK, ... .. hide: cr> drop table my_table11; - DROP OK (... sec) + DROP OK, ... dynamic ------- @@ -316,12 +316,12 @@ Examples:: ... title string, ... author string ... ); - CREATE OK (... sec) + CREATE OK, ... .. hide: cr> drop table my_table12; - DROP OK (... sec) + DROP OK, ... which is exactly the same as:: @@ -329,12 +329,12 @@ which is exactly the same as:: ... title string, ... author string ... ) with (column_policy = 'dynamic'); - CREATE OK (... sec) + CREATE OK, ... .. hide: cr> drop table my_table13; - DROP OK (... sec) + DROP OK, ... New columns added to ``dynamic`` tables are, once added, usable as usual columns. One can retrieve them, sort by them @@ -356,7 +356,7 @@ Creating a partitioned table is done using the :ref:`partitioned_by_clause`:: ... title string, ... date timestamp ... ) partitioned by (date); - CREATE OK (... sec) + CREATE OK, ... For further details, please refer to :ref:`partitioned_by_clause`. @@ -406,7 +406,7 @@ and is only available as a result column:: cr> create table my_table1b ( ... first_column string INDEX OFF ... ); - CREATE OK (... sec) + CREATE OK, ... .. note:: @@ -426,14 +426,14 @@ but can also be declared explicitly:: cr> create table my_table1b1 ( ... first_column string INDEX using plain ... ); - CREATE OK (... sec) + CREATE OK, ... This results in the same behaviour than without any index declaration:: cr> create table my_table1b2 ( ... first_column string ... ); - CREATE OK (... sec) + CREATE OK, ... .. _sql_ddl_index_fulltext: @@ -453,7 +453,7 @@ If no analyzer is specified when using a fulltext index, the cr> create table my_table1c ( ... first_column string INDEX using fulltext ... ); - CREATE OK (... sec) + CREATE OK, ... Defining the usage of a concrete analyzer is straight forward by defining the analyzer as a parameter using the ``WITH`` statement:: @@ -461,7 +461,7 @@ defining the analyzer as a parameter using the ``WITH`` statement:: cr> create table my_table1d ( ... first_column string INDEX using fulltext with (analyzer = 'english') ... ); - CREATE OK (... sec) + CREATE OK, ... Defining a named index column definition @@ -475,7 +475,7 @@ search for both, the exact and analyzed data:: ... first_column string, ... INDEX first_column_ft using fulltext (first_column) ... ); - CREATE OK (... sec) + CREATE OK, ... Of course defining a custom analyzer is possible here too:: @@ -484,7 +484,7 @@ Of course defining a custom analyzer is possible here too:: ... INDEX first_column_ft ... using fulltext(first_column) with (analyzer = 'english') ... ); - CREATE OK (... sec) + CREATE OK, ... .. _sql-ddl-composite-index: @@ -502,7 +502,7 @@ method:: ... INDEX title_body_ft ... using fulltext(title, body) with (analyzer = 'english') ... ); - CREATE OK (... sec) + CREATE OK, ... Composite indices can include nested columns within object columns as well:: @@ -514,7 +514,7 @@ Composite indices can include nested columns within object columns as well:: ... ), ... INDEX author_title_ft using fulltext(title, author['name']) ... ); - CREATE OK (... sec) + CREATE OK, ... .. _sql-ddl-custom-analyzer: @@ -558,7 +558,7 @@ Here is a simple Example:: ... ) ... ) ... ); - CREATE OK (... sec) + CREATE OK, ... This example creates an analyzer called ``myanalyzer`` to be used in index-definitions and index-constraints. It will use a @@ -586,7 +586,7 @@ You can extend and parameterize :ref:`builtin-analyzer` like this:: cr> create ANALYZER "german_snowball" extends snowball WITH ( ... language = 'german' ... ); - CREATE OK (... sec) + CREATE OK, ... If you extend :ref:`builtin-analyzer`, tokenizer, char-filter or token-filter cannot be defined. In this case use the parameters @@ -601,7 +601,7 @@ ommitted will be taken from the extended one. Example:: ... pattern = '.*' ... ) ... ); - CREATE OK (... sec) + CREATE OK, ... This analyzer will use the char-filters and token-filters from ``myanalyzer`` and will override the tokenizer with ``mypattern``. @@ -664,12 +664,12 @@ Updating Parameters The parameters of a table can be modified using the `ALTER TABLE` clause:: cr> alter table my_table1 set (number_of_replicas = '0-all'); - ALTER OK (... sec) + ALTER OK, ... In order to set a parameter to its default value use `reset`:: cr> alter table my_table1 reset (number_of_replicas); - ALTER OK (... sec) + ALTER OK, ... Read :ref:`Alter Partitioned Tables ` to see how to alter parameters of partitioned tables. @@ -681,7 +681,7 @@ In order to add a column to an existing table use ``ALTER TABLE`` with the ``ADD COLUMN`` clause:: cr> alter table my_table1 add column new_column_name string; - ALTER OK (... sec) + ALTER OK, ... The inner schema of object columns can also be extended, as shown in the following example. @@ -689,13 +689,13 @@ following example. First a column of type object is added:: cr> alter table my_table1 add column obj_column object as (age int); - ALTER OK (... sec) + ALTER OK, ... And now a nested column named ``name`` is added to the ``obj_column``:: cr> alter table my_table1 add column obj_column['name'] string; - ALTER OK (... sec) + ALTER OK, ... :: @@ -726,7 +726,7 @@ survive a cluster restart, if used with value on a restart:: cr> SET GLOBAL PERSISTENT stats.enabled = false; - SET OK (... sec) + SET OK, 1 row affected (... sec) :: @@ -742,7 +742,7 @@ You can change multiple values at once:: cr> SET GLOBAL TRANSIENT stats.enabled = true, ... stats.jobs_log_size = 1024, stats.operations_log_size = 4096; - SET OK (... sec) + SET OK, 1 row affected (... sec) :: @@ -764,7 +764,7 @@ settings:: ... jobs_log_size = 2048, ... operations_log_size = 8192 ... }; - SET OK (... sec) + SET OK, 1 row affected (... sec) :: @@ -780,7 +780,7 @@ Using the ``RESET`` statement, a setting will be reset to either on node startup defined configuration file value or to its default value:: cr> RESET GLOBAL stats.enabled, stats.operations_log_size; - RESET OK (... sec) + RESET OK, ... :: @@ -795,7 +795,7 @@ node startup defined configuration file value or to its default value:: ``RESET`` can also be done on objects:: cr> RESET GLOBAL stats; - RESET OK (... sec) + RESET OK, ... :: diff --git a/docs/sql/dml.txt b/docs/sql/dml.txt index 842120f5acd0..3d0f5490c1b3 100644 --- a/docs/sql/dml.txt +++ b/docs/sql/dml.txt @@ -55,7 +55,7 @@ Inserting Data By Query .. Hidden: refresh locations cr> refresh table locations - REFRESH OK (... sec) + REFRESH OK, ... It is possible to insert data using a query instead of values. Column data types of source and target table can differ as long as the values @@ -74,7 +74,7 @@ Example of changing a field's data type, in this case, changing the ... position short, ... description string ... ) clustered by (id) into 2 shards with (number_of_replicas = 0); - CREATE OK (... sec) + CREATE OK, ... :: @@ -88,8 +88,8 @@ Example of changing a field's data type, in this case, changing the .. Hidden: drop previously created table - cr> drop table locations2 - DROP OK (... sec) + cr> drop table locations2 + DROP OK, ... Example of creating a new partitioned table out of the ``locations`` table with data partitioned by year:: @@ -103,7 +103,7 @@ table with data partitioned by year:: ... position integer ... ) clustered by (id) into 2 shards ... partitioned by (year) with (number_of_replicas = 0); - CREATE OK (... sec) + CREATE OK, ... :: @@ -135,8 +135,8 @@ Resulting partitions of the last insert by query:: .. Hidden: drop previously created table - cr> drop table locations_parted; - DROP OK (... sec) + cr> drop table locations_parted; + DROP OK, ... .. note:: @@ -255,7 +255,7 @@ This example shows how to export a given table into files named after the table and shard id with gzip compression:: cr> refresh table quotes; - REFRESH OK... + REFRESH OK, ... :: diff --git a/docs/sql/information_schema.txt b/docs/sql/information_schema.txt index 2d804387d470..b71015602990 100644 --- a/docs/sql/information_schema.txt +++ b/docs/sql/information_schema.txt @@ -172,7 +172,7 @@ For further information see :ref:`sql_ddl_partitioned_by`. cr> create table a_partitioned_table (id int, content string) ... partitioned by (content); - CREATE OK (... sec) + CREATE OK, ... :: @@ -271,4 +271,5 @@ available: ``blob``, ``doc``, ``information_schema`` and ``sys``:: | information_schema | | sys | +--------------------+ - SELECT 4 rows in set (... sec) \ No newline at end of file + SELECT 4 rows in set (... sec) + diff --git a/docs/sql/occ.txt b/docs/sql/occ.txt index 1ddb593d2ab6..51657c849819 100644 --- a/docs/sql/occ.txt +++ b/docs/sql/occ.txt @@ -21,7 +21,7 @@ Every new row has an initial version of ``1``. This value is increased by ``1`` UPDATE OK, 3 rows affected (... sec) cr> refresh table locations; - REFRESH OK (... sec) + REFRESH OK, ... It's possible to fetch the ``_version`` by selecting it:: @@ -87,8 +87,7 @@ Known Limitations error:: cr> delete from locations where name = 'Aldebaran' and "_version" = 3; - SQLActionException["_version" column is only valid in the WHERE clau...] - + SQLActionException["_version" column is only valid in the WHERE clause if the primary key column is also present] .. note:: diff --git a/docs/sql/partitioned_tables.txt b/docs/sql/partitioned_tables.txt index f50a4c2800a6..e5273dc17092 100644 --- a/docs/sql/partitioned_tables.txt +++ b/docs/sql/partitioned_tables.txt @@ -50,7 +50,7 @@ using the :ref:`ref_clustered_clause`:: ... width double, ... day timestamp ... ) CLUSTERED BY (title) INTO 4 SHARDS PARTITIONED BY (day); - CREATE OK (... sec) + CREATE OK, ... This creates an empty partitioned table which is not yet backed by real partitions. Nonetheless does it behave like a *normal* table. @@ -143,7 +143,7 @@ no additional partition is created:: :: cr> REFRESH TABLE parted_table; - REFRESH OK (... sec) + REFRESH OK, ... :: @@ -180,7 +180,7 @@ atomic operation and could lead to inconsistent state:: :: cr> REFRESH TABLE parted_table; - REFRESH OK (... sec) + REFRESH OK, ... :: @@ -229,7 +229,7 @@ both existing partitions and partitions that will be created in the future. :: cr> ALTER TABLE parted_table SET (number_of_replicas = '0-all') - ALTER OK (... sec) + ALTER OK, ... Altering schema information (such as the column policy or adding @@ -239,7 +239,7 @@ and will take effect on both existing and future partitions of the table. :: cr> ALTER TABLE parted_table ADD COLUMN new_col string - ALTER OK (... sec) + ALTER OK, ... Unlike regular tables, it is possible to change the number of shards of a partitioned table. However, the shard configuration will only be applied @@ -248,7 +248,7 @@ on **future** partitions. :: cr> ALTER TABLE parted_table SET (number_of_shards = 10) - ALTER OK (... sec) + ALTER OK, ... .. note:: @@ -264,7 +264,7 @@ on **future** partitions. .. Hidden: refresh table:: cr> REFRESH TABLE parted_table; - REFRESH OK (... sec) + REFRESH OK, ... :: @@ -291,7 +291,7 @@ the :ref:`ref-alter-table-partition-clause`. :: cr> ALTER TABLE parted_table PARTITION (day=1396915200000) RESET (number_of_replicas) - ALTER OK (... sec) + ALTER OK, ... Limitations @@ -305,5 +305,5 @@ Limitations .. Hidden: drop table:: cr> drop table parted_table; - DROP OK (... sec) + DROP OK, ... diff --git a/docs/sql/queries.txt b/docs/sql/queries.txt index a41ed5fc51ac..744bc56a70cb 100644 --- a/docs/sql/queries.txt +++ b/docs/sql/queries.txt @@ -642,7 +642,7 @@ Examples:: :: cr> refresh table locations; - REFRESH OK (... sec) + REFRESH OK, ... :: diff --git a/docs/sql/refresh.txt b/docs/sql/refresh.txt index 0fc5e9d9cdb0..b377e2f22a84 100644 --- a/docs/sql/refresh.txt +++ b/docs/sql/refresh.txt @@ -12,7 +12,7 @@ If required a table can be refreshed explicitly in order to ensure that the latest state of the table gets fetched:: cr> refresh table locations; - REFRESH OK (... sec) + REFRESH OK, ... A table is refreshed periodically with a specified refresh interval. By default, the refresh interval is set to 1000 milliseconds. The refresh interval diff --git a/docs/sql/system.txt b/docs/sql/system.txt index 515c370a02d1..7ca2ec220cb9 100644 --- a/docs/sql/system.txt +++ b/docs/sql/system.txt @@ -31,7 +31,7 @@ the ``sys.cluster`` table: .. Hidden: reset settings cr> reset GLOBAL stats.enabled, stats.jobs_log_size, stats.operations_log_size; - RESET OK (... sec) + RESET OK, ... The result has at most 1 row:: @@ -523,7 +523,7 @@ performance overhead. In order to activate stats tracking :ref:`ref-set` can be used:: cr> set global stats.enabled = true; - SET OK (... sec) + SET OK, ... Jobs ---- @@ -591,7 +591,7 @@ enabled using the ``SET`` statement. The same statement can also be used to deactivate the stats tracking. This will also wipe all existing log entries:: cr> set global stats.enabled = false; - SET OK (... sec) + SET OK, ... :: @@ -621,13 +621,13 @@ Please refer to :ref:`ref-set` for a complete list of settings. For example to set the timeout to 30 minutes:: cr> SET GLOBAL TRANSIENT cluster.graceful_stop.timeout = 1800000; - SET OK (... sec) + SET OK, ... Crate supports string literals for time values the same way as the ``crate.yml`` does. So you can write the previous statmement as:: cr> SET GLOBAL TRANSIENT cluster.graceful_stop.timeout = '30m'; - SET OK (... sec) + SET OK, ... Note, that querying a time setting will always return a ``string`` value:: @@ -642,8 +642,9 @@ Note, that querying a time setting will always return a ``string`` value:: :: cr> SET GLOBAL TRANSIENT cluster.graceful_stop = {force=true}; - SET OK (... sec) + SET OK, ... +:: cr> select settings['cluster']['graceful_stop'] from sys.cluster; +---------------------------------------------------...-------------------+ diff --git a/docs/src/crate/tests.py b/docs/src/crate/tests.py index c79ae7ac518c..e429ff156c61 100644 --- a/docs/src/crate/tests.py +++ b/docs/src/crate/tests.py @@ -9,8 +9,25 @@ from .paths import crate_path, project_path from .ports import random_available_port from crate.crash.command import CrateCmd +from crate.crash.printer import PrintWrapper, ColorPrinter from crate.client import connect -cmd = CrateCmd() + + +class CrateTestCmd(CrateCmd): + + def __init__(self, **kwargs): + super(CrateTestCmd, self).__init__(**kwargs) + doctest_print = PrintWrapper() + self.logger = ColorPrinter(False, stream=doctest_print, line_end='') + + def stmt(self, stmt): + stmt = stmt.replace('\n', ' ') + if stmt.startswith('\\'): + self.process(stmt) + else: + self.execute(stmt) + +cmd = CrateTestCmd(is_tty=False) CRATE_HTTP_PORT = random_available_port() @@ -36,7 +53,7 @@ def bash_transform(s): s = s.replace(':4200/', ':{0}/'.format(CRATE_HTTP_PORT)) if s.startswith("crash"): s = re.search(r"crash\s+-c\s+\"(.*?)\"", s).group(1) - return ('cmd.onecmd("""{0}""");'.format(s.strip())) + return u'cmd.stmt({0})'.format(repr(s.strip().rstrip(';'))) return ( r'import subprocess;' r'print(subprocess.check_output(r"""%s""",stderr=subprocess.STDOUT,shell=True))' % s) + '\n' @@ -49,7 +66,7 @@ def crash_transform(s): if s.startswith('_'): return s[1:] s = s.replace(':4200', ':{0}'.format(CRATE_HTTP_PORT)) - return ('cmd.onecmd("""{0}""");'.format(s.strip().strip(";"))) + return u'cmd.stmt({0})'.format(repr(s.strip().rstrip(';'))) bash_parser = zc.customdoctests.DocTestParser( @@ -63,7 +80,7 @@ class ConnectingCrateLayer(CrateLayer): def start(self): super(ConnectingCrateLayer, self).start() - cmd.do_connect(self.crate_servers[0]) + cmd._connect(self.crate_servers[0]) empty_layer = ConnectingCrateLayer('crate', crate_home=crate_path(), @@ -74,7 +91,7 @@ def start(self): def setUpLocations(test): test.globs['cmd'] = cmd - cmd.onecmd(""" + cmd.stmt(""" create table locations ( id string primary key, name string, @@ -92,19 +109,18 @@ def setUpLocations(test): ), index name_description_ft using fulltext(name, description) with (analyzer='english') ) clustered by(id) into 2 shards with (number_of_replicas=0)""".strip()) - cmd.onecmd("delete from locations") + cmd.stmt("delete from locations") locations_file = os.path.abspath(os.path.join(os.path.dirname(__file__), "locations.json")) - cmd.onecmd("""copy locations from '{0}'""".format(locations_file)) - cmd.onecmd("""refresh table locations""") + cmd.stmt("""copy locations from '{0}'""".format(locations_file)) + cmd.stmt("""refresh table locations""") def setUpQuotes(test): test.globs['cmd'] = cmd - cmd.onecmd(""" + cmd.stmt(""" create table quotes ( id integer primary key, quote string - ) clustered by(id) into 2 shards with(number_of_replicas=0) - """.strip()) + ) clustered by(id) into 2 shards with(number_of_replicas=0)""") import_dir = '/tmp/import_data' if not os.path.isdir(import_dir): @@ -138,7 +154,7 @@ def setUp(test): def tearDownDropQuotes(test): - cmd.onecmd("drop table quotes") + cmd.stmt("drop table quotes") def test_suite(): diff --git a/docs/versions.cfg b/docs/versions.cfg index 55a99ddc5105..80678eb4592f 100644 --- a/docs/versions.cfg +++ b/docs/versions.cfg @@ -1,11 +1,10 @@ [versions] Jinja2 = 2.7.3 MarkupSafe = 0.23 -Pygments = 1.6 SQLAlchemy = 0.9.8 Sphinx = 1.2.3 appdirs = 1.4.0 -crash = 0.10.3 +crash = 0.11.1 crate = 0.12.3 crate-docs-theme = 0.3.6 docutils = 0.12 @@ -39,3 +38,20 @@ zope.exceptions = 4.0.7 # zope.testing==4.1.3 # zope.testrunner==4.4.3 zope.interface = 4.1.1 + +# Required by: +# crash==0.11.1 +# prompt-toolkit==0.21 +Pygments = 2.0.2 + +# Required by: +# crash==0.11.1 +colorama = 0.3.3 + +# Required by: +# prompt-toolkit==0.21 +docopt = 0.6.2 + +# Required by: +# prompt-toolkit==0.21 +wcwidth = 0.1.4