sashapolo commented on code in PR #831:
URL: https://github.com/apache/ignite-3/pull/831#discussion_r886586354
##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/PageMemoryStorageEngine.java:
##########
@@ -109,4 +107,18 @@ public TableStorage createTable(TableConfiguration
tableCfg) {
return new VolatilePageMemoryTableStorage(tableCfg, dataRegion);
}
+
+ /**
+ * Creates, starts and adds a new date region to the engine.
Review Comment:
```suggestion
* Creates, starts and adds a new data region to the engine.
```
##########
modules/cli/README.md:
##########
@@ -22,6 +22,10 @@ Node start:
Node stop:
ignite stop consistent-id
+
+Cluster initialization:
+
+ ignite cluster init --cluster-name=cluster-name
--node-endpoint=localhost:10300 --meta-storage-node=consistent-id
--cmg-node=consistent-id
Review Comment:
missing newline
##########
examples/src/main/java/org/apache/ignite/example/storage/VolatilePageMemoryStorageExample.java:
##########
@@ -0,0 +1,170 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.example.storage;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.Statement;
+
+/**
+ * This example demonstrates a usage of the PageMemory storage engine
configured with an in-memory data region.
+ *
+ * <p>To run the example, do the following:
+ * <ol>
+ * <li>Import the examples project into you IDE.</li>
+ * <li>
+ * Download and prepare artifacts for run Ignite node using the CLI
tool (if not done yet):<br>
+ * {@code ignite init}
+ * </li>
+ * <li>
+ * Add module "ignite-storage-page-memory" using the CLI tool (if not
done yet):<br>
+ * {@code ignite module add
mvn:org.apache.ignite:ignite-storage-page-memory:version}<br>
+ * For example:<br>
+ * {@code ignite module add
mvn:org.apache.ignite:ignite-storage-page-memory:3.0.0-SNAPSHOT}<br>
+ * </li>
+ * <li>
+ * Start a server node using the CLI tool:<br>
+ * {@code ignite node start
--config=$IGNITE_HOME/examples/config/ignite-config.json my-first-node}
+ * </li>
+ * <li>
+ * Cluster initialization using the CLI tool (if not done yet):<br>
+ * {@code ignite cluster init --cluster-name=ignite-cluster
--node-endpoint=localhost:10300 --meta-storage-node=my-first-node}
+ * </li>
+ * <li>
+ * Add configuration for in-memory data region of of the PageMemory
storage engine using the CLI tool (if not done yet):<br>
+ * {@code ignite config set --type=cluster
"{pageMemory:{regions:[{name:in-memory,persistent:false}]}}"}
+ * </li>
+ * <li>Run the example in the IDE.</li>
+ * <li>
+ * Stop a server node using the CLI tool:<br>
+ * {@code ignite node stop my-first-node}
+ * </li>
+ * <li>
+ * Remove module "ignite-storage-page-memory" using the CLI tool (if
not done yet):<br>
Review Comment:
Why is this step required?
##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/PageMemoryStorageEngine.java:
##########
@@ -109,4 +107,18 @@ public TableStorage createTable(TableConfiguration
tableCfg) {
return new VolatilePageMemoryTableStorage(tableCfg, dataRegion);
}
+
+ /**
+ * Creates, starts and adds a new date region to the engine.
+ *
+ * @param name Data region name.
+ * @param dataRegionConfig Data region configuration.
+ */
+ private void addDataRegion(String name, PageMemoryDataRegionConfiguration
dataRegionConfig, int pageSize) {
Review Comment:
Why do we need the `pageSize` parameter? Can it be computed based on the
`engineConfig` field?
##########
examples/src/integrationTest/java/org/apache/ignite/example/AbstractExamplesTest.java:
##########
@@ -52,7 +59,16 @@ public void startNode() {
IgnitionManager.init(TEST_NODE_NAME, List.of(TEST_NODE_NAME),
"cluster");
- assertThat(ignite, willCompleteSuccessfully());
+ assertThat(igniteFuture, willCompleteSuccessfully());
+
+ ignite = (IgniteImpl) igniteFuture.get(1, TimeUnit.MILLISECONDS);
Review Comment:
you can use `join()` here, because the future is guaranteed to be completed
after the assertion above
##########
examples/src/integrationTest/java/org/apache/ignite/example/AbstractExamplesTest.java:
##########
@@ -52,7 +59,16 @@ public void startNode() {
IgnitionManager.init(TEST_NODE_NAME, List.of(TEST_NODE_NAME),
"cluster");
- assertThat(ignite, willCompleteSuccessfully());
+ assertThat(igniteFuture, willCompleteSuccessfully());
+
+ ignite = (IgniteImpl) igniteFuture.get(1, TimeUnit.MILLISECONDS);
+
+ ignite
+ .clusterConfiguration()
Review Comment:
What is this for? Can you leave a comment?
##########
examples/src/main/java/org/apache/ignite/example/tx/TransactionsExample.java:
##########
@@ -32,10 +32,22 @@
* <ol>
* <li>Import the examples project into you IDE.</li>
* <li>
+ * Download and prepare artifacts for run Ignite node using the CLI
tool (if not done yet):<br>
Review Comment:
```suggestion
* Download and prepare artifacts for running an Ignite node using
the CLI tool (if not done yet):<br>
```
##########
examples/src/main/java/org/apache/ignite/example/tx/TransactionsExample.java:
##########
@@ -32,10 +32,22 @@
* <ol>
* <li>Import the examples project into you IDE.</li>
* <li>
+ * Download and prepare artifacts for run Ignite node using the CLI
tool (if not done yet):<br>
Review Comment:
please apply this to all similar places
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]