This is an automated email from the ASF dual-hosted git repository. abudnikov pushed a commit to branch IGNITE-7595 in repository https://gitbox.apache.org/repos/asf/ignite.git
commit 0f5579908a67ea3cf4a2385b6a5bc222a95cbdba Author: abudnikov <[email protected]> AuthorDate: Mon Aug 24 17:25:42 2020 +0300 minor updates --- docs/_docs/SQL/custom-sql-func.adoc | 6 +- .../org/apache/ignite/snippets/JavaThinClient.java | 1 + .../org/apache/ignite/snippets/SQLFunctions.java | 60 ------ .../java/org/apache/ignite/snippets/SqlAPI.java | 224 ++++++++++++--------- .../installation/installing-using-docker.adoc | 12 +- .../kubernetes/generic-configuration.adoc | 3 +- docs/_docs/quick-start/dotnet.adoc | 2 +- docs/_docs/restapi.adoc | 9 +- 8 files changed, 149 insertions(+), 168 deletions(-) diff --git a/docs/_docs/SQL/custom-sql-func.adoc b/docs/_docs/SQL/custom-sql-func.adoc index d1699cf..4fc97ee 100644 --- a/docs/_docs/SQL/custom-sql-func.adoc +++ b/docs/_docs/SQL/custom-sql-func.adoc @@ -1,6 +1,6 @@ = Custom SQL Functions -:javaFile: {javaCodeDir}/SQLFunctions.java +:javaFile: {javaCodeDir}/SqlAPI.java The SQL Engine can extend the SQL functions' set, defined by the ANSI-99 specification, via the addition of custom SQL functions written in Java. @@ -22,14 +22,14 @@ To do that, use the `setSqlFunctionClasses(...)` method. [source,java] ---- -include::{javaFile}[tags=config, indent=0] +include::{javaFile}[tags=sql-function-config, indent=0] ---- Once you have deployed a cache with the above configuration, you can call the custom function from within SQL queries: [source,java] ---- -include::{javaFile}[tags=query, indent=0] +include::{javaFile}[tags=sql-function-query, indent=0] ---- NOTE: Classes registered with `CacheConfiguration.setSqlFunctionClasses(...)` must be added to the classpath of all the nodes where the defined custom functions might be executed. Otherwise, you will get a `ClassNotFoundException` error when trying to execute the custom function. diff --git a/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/JavaThinClient.java b/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/JavaThinClient.java index 457f03a..2b60262 100644 --- a/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/JavaThinClient.java +++ b/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/JavaThinClient.java @@ -85,6 +85,7 @@ public class JavaThinClient { //end::tx[] } + @Test void transactionConfiguration() { // tag::transaction-config[] diff --git a/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/SQLFunctions.java b/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/SQLFunctions.java deleted file mode 100644 index c1f3723..0000000 --- a/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/SQLFunctions.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.apache.ignite.snippets; - -import org.apache.ignite.Ignite; -import org.apache.ignite.IgniteCache; -import org.apache.ignite.Ignition; -import org.apache.ignite.cache.query.SqlFieldsQuery; -import org.apache.ignite.cache.query.annotations.QuerySqlFunction; -import org.apache.ignite.configuration.CacheConfiguration; -import org.junit.jupiter.api.Test; - -public class SQLFunctions { - - // tag::sql-function-example[] - @QuerySqlFunction - public static int sqr(int x) { - return x * x; - } - // end::sql-function-example[] - - @Test - IgniteCache setSqlFunction(Ignite ignite) { - - // tag::config[] - // Preparing a cache configuration. - CacheConfiguration cfg = new CacheConfiguration("myCache"); - - // Registering the class that contains custom SQL functions. - cfg.setSqlFunctionClasses(SQLFunctions.class); - - IgniteCache cache = ignite.createCache(cfg); - // end::config[] - - return cache; - } - - void call(IgniteCache cache) { - - // tag::query[] - // Preparing the query that uses the custom defined 'sqr' function. - SqlFieldsQuery query = new SqlFieldsQuery("SELECT name FROM myCache WHERE sqr(size) > 100"); - - // Executing the query. - cache.query(query).getAll(); - - // end::query[] - } - - public static void main(String[] args) { - - try (Ignite ignite = Ignition.start()) { - SQLFunctions sqlf = new SQLFunctions(); - IgniteCache cache = sqlf.setSqlFunction(ignite); - sqlf.call(cache); - } catch (Exception e) { - e.printStackTrace(); - } - - } - -} diff --git a/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/SqlAPI.java b/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/SqlAPI.java index 0b49dda..0fd8941 100644 --- a/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/SqlAPI.java +++ b/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/SqlAPI.java @@ -9,129 +9,171 @@ import org.apache.ignite.IgniteCache; import org.apache.ignite.cache.query.QueryCursor; import org.apache.ignite.cache.query.SqlFieldsQuery; import org.apache.ignite.cache.query.annotations.QuerySqlField; +import org.apache.ignite.cache.query.annotations.QuerySqlFunction; import org.apache.ignite.configuration.CacheConfiguration; +import org.junit.jupiter.api.Test; public class SqlAPI { - class Person implements Serializable { - /** Indexed field. Will be visible to the SQL engine. */ - @QuerySqlField(index = true) - private long id; + class Person implements Serializable { + /** Indexed field. Will be visible to the SQL engine. */ + @QuerySqlField(index = true) + private long id; - /** Queryable field. Will be visible to the SQL engine. */ - @QuerySqlField - private String name; + /** Queryable field. Will be visible to the SQL engine. */ + @QuerySqlField + private String name; - /** Will NOT be visible to the SQL engine. */ - private int age; + /** Will NOT be visible to the SQL engine. */ + private int age; - /** - * Indexed field sorted in descending order. Will be visible to the SQL engine. - */ - @QuerySqlField(index = true, descending = true) - private float salary; - } + /** + * Indexed field sorted in descending order. Will be visible to the SQL engine. + */ + @QuerySqlField(index = true, descending = true) + private float salary; + } - void cancellingByTimeout() { - // tag::set-timeout[] - SqlFieldsQuery query = new SqlFieldsQuery("SELECT * from Person"); + void cancellingByTimeout() { + // tag::set-timeout[] + SqlFieldsQuery query = new SqlFieldsQuery("SELECT * from Person"); + + // Setting query execution timeout + query.setTimeout(10_000, TimeUnit.SECONDS); - // Setting query execution timeout - query.setTimeout(10_000, TimeUnit.SECONDS); + // end::set-timeout[] + } + + void cancellingByCallingClose(IgniteCache<Long, Person> cache) { + // tag::cancel-by-closing[] + SqlFieldsQuery query = new SqlFieldsQuery("SELECT * FROM Person"); + + // Executing the query + QueryCursor<List<?>> cursor = cache.query(query); + + // Halting the query that might be still in progress. + cursor.close(); + + // end::cancel-by-closing[] + } - // end::set-timeout[] - } + void enforceJoinOrder() { - void cancellingByCallingClose(IgniteCache<Long, Person> cache) { - // tag::cancel-by-closing[] - SqlFieldsQuery query = new SqlFieldsQuery("SELECT * FROM Person"); + // tag::enforceJoinOrder[] + SqlFieldsQuery query = new SqlFieldsQuery( + "SELECT * FROM TABLE_A, TABLE_B USE INDEX(HASH_JOIN_IDX)" + + " WHERE TABLE_A.column1 = TABLE_B.column2").setEnforceJoinOrder(true); + // end::enforceJoinOrder[] + } - // Executing the query - QueryCursor<List<?>> cursor = cache.query(query); + void simpleQuery(Ignite ignite) { + // tag::simple-query[] + IgniteCache<Long, Person> cache = ignite.cache("Person"); - // Halting the query that might be still in progress. - cursor.close(); + SqlFieldsQuery sql = new SqlFieldsQuery( + "select concat(firstName, ' ', lastName) from Person"); - // end::cancel-by-closing[] - } + // Iterate over the result set. + try (QueryCursor<List<?>> cursor = cache.query(sql)) { + for (List<?> row : cursor) + System.out.println("personName=" + row.get(0)); + } + // end::simple-query[] + } - void enforceJoinOrder() { + void insert(Ignite ignite) { + // tag::insert[] + IgniteCache<Long, Person> cache = ignite.cache("personCache"); - // tag::enforceJoinOrder[] - SqlFieldsQuery query = new SqlFieldsQuery( - "SELECT * FROM TABLE_A, TABLE_B USE INDEX(HASH_JOIN_IDX)" + " WHERE TABLE_A.column1 = TABLE_B.column2") - .setEnforceJoinOrder(true); - // end::enforceJoinOrder[] - } + cache.query( + new SqlFieldsQuery("INSERT INTO Person(id, firstName, lastName) VALUES(?, ?, ?)") + .setArgs(1L, "John", "Smith")) + .getAll(); - void simpleQuery(Ignite ignite) { - // tag::simple-query[] - IgniteCache<Long, Person> cache = ignite.cache("Person"); + // end::insert[] - SqlFieldsQuery sql = new SqlFieldsQuery("select concat(firstName, ' ', lastName) from Person"); + } - // Iterate over the result set. - try (QueryCursor<List<?>> cursor = cache.query(sql)) { - for (List<?> row : cursor) - System.out.println("personName=" + row.get(0)); - } - // end::simple-query[] - } + void update(Ignite ignite) { + // tag::update[] + IgniteCache<Long, Person> cache = ignite.cache("personCache"); - void insert(Ignite ignite) { - // tag::insert[] - IgniteCache<Long, Person> cache = ignite.cache("personCache"); + cache.query(new SqlFieldsQuery("UPDATE Person set lastName = ? " + "WHERE id >= ?") + .setArgs("Jones", 2L)).getAll(); + // end::update[] + } - cache.query(new SqlFieldsQuery("INSERT INTO Person(id, firstName, lastName) VALUES(?, ?, ?)").setArgs(1L, - "John", "Smith")).getAll(); + void delete(Ignite ignite) { + // tag::delete[] + IgniteCache<Long, Person> cache = ignite.cache("personCache"); - // end::insert[] + cache.query(new SqlFieldsQuery("DELETE FROM Person " + "WHERE id >= ?").setArgs(2L)) + .getAll(); - } + // end::delete[] + } - void update(Ignite ignite) { - // tag::update[] - IgniteCache<Long, Person> cache = ignite.cache("personCache"); + void merge(Ignite ignite) { + // tag::merge[] + IgniteCache<Long, Person> cache = ignite.cache("personCache"); - cache.query(new SqlFieldsQuery("UPDATE Person set lastName = ? " + "WHERE id >= ?").setArgs("Jones", 2L)) - .getAll(); - // end::update[] - } + cache.query(new SqlFieldsQuery("MERGE INTO Person(id, firstName, lastName)" + + " values (1, 'John', 'Smith'), (5, 'Mary', 'Jones')")).getAll(); + // end::merge[] + } - void delete(Ignite ignite) { - // tag::delete[] - IgniteCache<Long, Person> cache = ignite.cache("personCache"); + void setSchema() { + // tag::set-schema[] + SqlFieldsQuery sql = new SqlFieldsQuery("select name from City").setSchema("PERSON"); + // end::set-schema[] + } - cache.query(new SqlFieldsQuery("DELETE FROM Person " + "WHERE id >= ?").setArgs(2L)).getAll(); + void createTable(Ignite ignite) { + // tag::create-table[] + IgniteCache<Long, Person> cache = ignite + .getOrCreateCache(new CacheConfiguration<Long, Person>().setName("Person")); - // end::delete[] - } + // Creating City table. + cache.query(new SqlFieldsQuery( + "CREATE TABLE City (id int primary key, name varchar, region varchar)")).getAll(); + // end::create-table[] + } - void merge(Ignite ignite) { - // tag::merge[] - IgniteCache<Long, Person> cache = ignite.cache("personCache"); + // tag::sql-function-example[] + static class SqlFunctions { + @QuerySqlFunction + public static int sqr(int x) { + return x * x; + } + } - cache.query(new SqlFieldsQuery( - "MERGE INTO Person(id, firstName, lastName)" + " values (1, 'John', 'Smith'), (5, 'Mary', 'Jones')")) - .getAll(); - // end::merge[] - } + // end::sql-function-example[] - void setSchema() { - // tag::set-schema[] - SqlFieldsQuery sql = new SqlFieldsQuery("select name from City").setSchema("PERSON"); - // end::set-schema[] - } + @Test + IgniteCache setSqlFunction(Ignite ignite) { - void createTable(Ignite ignite) { - // tag::create-table[] - IgniteCache<Long, Person> cache = ignite - .getOrCreateCache(new CacheConfiguration<Long, Person>().setName("Person")); + // tag::sql-function-config[] + // Preparing a cache configuration. + CacheConfiguration cfg = new CacheConfiguration("myCache"); - // Creating City table. - cache.query(new SqlFieldsQuery("CREATE TABLE City (id int primary key, name varchar, region varchar)")) - .getAll(); + // Registering the class that contains custom SQL functions. + cfg.setSqlFunctionClasses(SqlFunctions.class); - // end::create-table[] - } + IgniteCache cache = ignite.createCache(cfg); + // end::sql-function-config[] + + return cache; + } + + void call(IgniteCache cache) { + + // tag::sql-function-query[] + // Preparing the query that uses the custom defined 'sqr' function. + SqlFieldsQuery query = new SqlFieldsQuery("SELECT name FROM myCache WHERE sqr(size) > 100"); + + // Executing the query. + cache.query(query).getAll(); + + // end::sql-function-query[] + } } diff --git a/docs/_docs/installation/installing-using-docker.adoc b/docs/_docs/installation/installing-using-docker.adoc index 21125b9..d0e1952 100644 --- a/docs/_docs/installation/installing-using-docker.adoc +++ b/docs/_docs/installation/installing-using-docker.adoc @@ -92,8 +92,8 @@ The following command launches the Ignite Docker image and passes the work direc [source,shell] ---- docker run -d \ - -v persistence-volume:/persistence \ - -e IGNITE_WORK_DIR=/persistence \ + -v storage-volume:/storage \ + -e IGNITE_WORK_DIR=/storage \ apacheignite/ignite ---- @@ -108,13 +108,13 @@ When restarting the container with the same command, Ignite will load the data f mkdir work_dir docker run -d \ - -v ${PWD}/work_dir:/persistence \ - -e IGNITE_WORK_DIR=/persistence \ + -v ${PWD}/work_dir:/storage \ + -e IGNITE_WORK_DIR=/storage \ apacheignite/ignite ---- -The `-v` option mounts a local directory under the `/persistence` path in the container. -The `-e IGNITE_WORK_DIR=/persistence` option tells Ignite to use this folder as the work directory. +The `-v` option mounts a local directory under the `/storage` path in the container. +The `-e IGNITE_WORK_DIR=/storage` option tells Ignite to use this folder as the work directory. == Providing Configuration File diff --git a/docs/_docs/installation/kubernetes/generic-configuration.adoc b/docs/_docs/installation/kubernetes/generic-configuration.adoc index f806388..e639112 100644 --- a/docs/_docs/installation/kubernetes/generic-configuration.adoc +++ b/docs/_docs/installation/kubernetes/generic-configuration.adoc @@ -284,10 +284,9 @@ If you are using persistence, you must activate the cluster after it is started. Execute the following command: - *TODO:check the path to control.sh:* [source, shell] ---- -/opt/apache-ignite/bin/control.sh --set-state ACTIVE --yes +/opt/ignite/apache-ignite/bin/control.sh --set-state ACTIVE --yes ---- You can also activate the cluster using the link:restapi#change-cluster-state[REST API]. diff --git a/docs/_docs/quick-start/dotnet.adoc b/docs/_docs/quick-start/dotnet.adoc index a15dff0..f671030 100644 --- a/docs/_docs/quick-start/dotnet.adoc +++ b/docs/_docs/quick-start/dotnet.adoc @@ -19,7 +19,7 @@ Ignite for .NET supports a thick client and a thin client. Because this guide fo For information about the .NET thin client, see link:thin-clients/dotnet-thin-client[.NET Thin Client]. ==== -//TODO??: WARNING: If you use the thick client without downloading and installing GridGain distribution, some functionality (Logging, etc.) will be missing or not configured. +//TODO??: WARNING: If you use the thick client without downloading and installing Ignite distribution, some functionality (Logging, etc.) will be missing or not configured. . Install .NET Core SDK (version 2+): https://dotnet.microsoft.com/download diff --git a/docs/_docs/restapi.adoc b/docs/_docs/restapi.adoc index a7790c9..3a60408 100644 --- a/docs/_docs/restapi.adoc +++ b/docs/_docs/restapi.adoc @@ -337,6 +337,7 @@ Returns `true` if the cluster is active. Returns `false` if the cluster in inact === Change Cluster State +The `setstate` command changes the link:cluster-states[cluster state]. *Request:*:: + @@ -346,22 +347,20 @@ Returns `true` if the cluster is active. Returns `false` if the cluster in inact http://host:port/ignite?cmd=setstate&state={new_state} ---- -[{request_table_props}] +[cols="15%,10%,75%",options="header"] |=== |Parameter |Type -|Optional |Description -|Example -|`state` | String| No a| New cluster state. One of the values: +|`state` | String a| New cluster state. One of the values: * `ACTIVE`: active state, * `ACTIVE_READ_ONLY`: read only state, * `INACTIVE`: the cluster is deactivated. include::includes/note-on-deactivation.adoc[] -| + |=== --
