You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "IgGusev (via GitHub)" <gi...@apache.org> on 2025/11/21 13:04:07 UTC

[PR] IGNITE-27135 Add distribution zone SQL example [ignite-3]

IgGusev opened a new pull request, #7035:
URL: https://github.com/apache/ignite-3/pull/7035

   Thank you for submitting the pull request.
   
   To streamline the review process of the patch and ensure better code quality
   we ask both an author and a reviewer to verify the following:
   
   ### The Review Checklist
   - [ ] **Formal criteria:** TC status, codestyle, mandatory documentation. Also make sure to complete the following:  
   \- There is a single JIRA ticket related to the pull request.  
   \- The web-link to the pull request is attached to the JIRA ticket.  
   \- The JIRA ticket has the Patch Available state.  
   \- The description of the JIRA ticket explains WHAT was made, WHY and HOW.  
   \- The pull request title is treated as the final commit message. The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
   - [ ] **Design:** new code conforms with the design principles of the components it is added to.
   - [ ] **Patch quality:** patch cannot be split into smaller pieces, its size must be reasonable.
   - [ ] **Code quality:** code is clean and readable, necessary developer documentation is added if needed.
   - [ ] **Tests code quality:** test set covers positive/negative scenarios, happy/edge cases. Tests are effective in terms of execution time and resources.
   
   ### Notes
   - [Apache Ignite Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Java+Code+Style+Guide)


-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-27135 Add distribution zone SQL example [ignite-3]

Posted by "ygerzhedovich (via GitHub)" <gi...@apache.org>.
ygerzhedovich merged PR #7035:
URL: https://github.com/apache/ignite-3/pull/7035


-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-27135 Add distribution zone SQL example [ignite-3]

Posted by "ygerzhedovich (via GitHub)" <gi...@apache.org>.
ygerzhedovich commented on code in PR #7035:
URL: https://github.com/apache/ignite-3/pull/7035#discussion_r2556005978


##########
examples/sql/distribution-zones.sql:
##########
@@ -0,0 +1,77 @@
+-- Drop tables first (zones cannot be dropped while tables use them)
+DROP TABLE IF EXISTS person;
+DROP TABLE IF EXISTS department;
+DROP TABLE IF EXISTS employee;
+DROP TABLE IF EXISTS my_table;
+
+-- Drop distribution zones
+DROP ZONE IF EXISTS renamed_zone;
+DROP ZONE IF EXISTS "my_example_zone";
+DROP ZONE IF EXISTS auto_scale_up_zone;
+DROP ZONE IF EXISTS auto_scale_down_zone;
+DROP ZONE IF EXISTS high_availability_zone;
+
+-- Create a case-insensitive distribution zone (example_zone)
+CREATE ZONE IF NOT EXISTS example_zone STORAGE PROFILES['default'];
+
+-- Create a case-sensitive distribution zone ("my_example_zone")
+CREATE ZONE IF NOT EXISTS "my_example_zone" STORAGE PROFILES['default'];
+
+-- Create a zone that waits 300 seconds before adding new nodes
+CREATE ZONE IF NOT EXISTS auto_scale_up_zone (AUTO SCALE UP 300) STORAGE PROFILES['default'];
+
+-- Create a zone that waits 600 seconds before removing idle nodes
+CREATE ZONE IF NOT EXISTS auto_scale_down_zone (AUTO SCALE DOWN 600) STORAGE PROFILES['default'];
+
+-- The following example requires nodes to be configured with
+-- the 'storage' attribute set to 'SSD'. To configure node attributes,
+-- use the GridGain CLI or configuration files.
+-- CREATE ZONE IF NOT EXISTS ssd_only_zone (NODES FILTER '$[?(@.storage == "SSD")]') STORAGE PROFILES['default'];
+
+-- Create a zone with high availability mode and 5 replicas
+CREATE ZONE IF NOT EXISTS high_availability_zone (
+  REPLICAS 5,
+  CONSISTENCY MODE 'HIGH_AVAILABILITY'
+) STORAGE PROFILES['default'];
+
+-- Rename example_zone to renamed_zone
+ALTER ZONE IF EXISTS example_zone RENAME TO renamed_zone;
+
+-- Set the number of replicas for renamed_zone to 10
+ALTER ZONE IF EXISTS renamed_zone SET REPLICAS 10;
+
+-- Set multiple parameters at once: replicas, quorum size, and node filter
+ALTER ZONE IF EXISTS high_availability_zone SET (
+  REPLICAS 5,
+  QUORUM SIZE 3
+);
+
+-- Create a person table using the renamed zone
+CREATE TABLE IF NOT EXISTS person (
+  id INT PRIMARY KEY,
+  city_id INT,
+  name VARCHAR,
+  age INT,
+  company VARCHAR
+) ZONE renamed_zone;
+
+-- Create a department table using the high availability zone
+CREATE TABLE IF NOT EXISTS department (
+  dept_id INT PRIMARY KEY,
+  dept_name VARCHAR,
+  location VARCHAR
+) ZONE high_availability_zone;
+
+-- Create a table using the case-sensitive zone name
+CREATE TABLE IF NOT EXISTS employee (
+  emp_id INT PRIMARY KEY,
+  dept_id INT,
+  emp_name VARCHAR,
+  salary DECIMAL
+) ZONE "my_example_zone";
+
+-- Show all distribution zones
+SELECT * FROM SYSTEM.ZONES;
+
+-- Show specific zone details
+SELECT * FROM SYSTEM.ZONES WHERE NAME = 'renamed_zone';

Review Comment:
   name should be lowercased



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-27135 Add distribution zone SQL example [ignite-3]

Posted by "ygerzhedovich (via GitHub)" <gi...@apache.org>.
ygerzhedovich commented on code in PR #7035:
URL: https://github.com/apache/ignite-3/pull/7035#discussion_r2556007864


##########
examples/sql/distribution-zones.sql:
##########
@@ -0,0 +1,77 @@
+-- Drop tables first (zones cannot be dropped while tables use them)
+DROP TABLE IF EXISTS person;
+DROP TABLE IF EXISTS department;
+DROP TABLE IF EXISTS employee;
+DROP TABLE IF EXISTS my_table;
+
+-- Drop distribution zones
+DROP ZONE IF EXISTS renamed_zone;
+DROP ZONE IF EXISTS "my_example_zone";
+DROP ZONE IF EXISTS auto_scale_up_zone;
+DROP ZONE IF EXISTS auto_scale_down_zone;
+DROP ZONE IF EXISTS high_availability_zone;
+
+-- Create a case-insensitive distribution zone (example_zone)
+CREATE ZONE IF NOT EXISTS example_zone STORAGE PROFILES['default'];
+
+-- Create a case-sensitive distribution zone ("my_example_zone")
+CREATE ZONE IF NOT EXISTS "my_example_zone" STORAGE PROFILES['default'];
+
+-- Create a zone that waits 300 seconds before adding new nodes
+CREATE ZONE IF NOT EXISTS auto_scale_up_zone (AUTO SCALE UP 300) STORAGE PROFILES['default'];
+
+-- Create a zone that waits 600 seconds before removing idle nodes
+CREATE ZONE IF NOT EXISTS auto_scale_down_zone (AUTO SCALE DOWN 600) STORAGE PROFILES['default'];
+
+-- The following example requires nodes to be configured with
+-- the 'storage' attribute set to 'SSD'. To configure node attributes,
+-- use the GridGain CLI or configuration files.
+-- CREATE ZONE IF NOT EXISTS ssd_only_zone (NODES FILTER '$[?(@.storage == "SSD")]') STORAGE PROFILES['default'];
+
+-- Create a zone with high availability mode and 5 replicas
+CREATE ZONE IF NOT EXISTS high_availability_zone (
+  REPLICAS 5,
+  CONSISTENCY MODE 'HIGH_AVAILABILITY'
+) STORAGE PROFILES['default'];
+
+-- Rename example_zone to renamed_zone
+ALTER ZONE IF EXISTS example_zone RENAME TO renamed_zone;
+
+-- Set the number of replicas for renamed_zone to 10
+ALTER ZONE IF EXISTS renamed_zone SET REPLICAS 10;
+
+-- Set multiple parameters at once: replicas, quorum size, and node filter
+ALTER ZONE IF EXISTS high_availability_zone SET (
+  REPLICAS 5,
+  QUORUM SIZE 3
+);
+
+-- Create a person table using the renamed zone
+CREATE TABLE IF NOT EXISTS person (
+  id INT PRIMARY KEY,
+  city_id INT,
+  name VARCHAR,
+  age INT,
+  company VARCHAR
+) ZONE renamed_zone;
+
+-- Create a department table using the high availability zone
+CREATE TABLE IF NOT EXISTS department (
+  dept_id INT PRIMARY KEY,
+  dept_name VARCHAR,
+  location VARCHAR
+) ZONE high_availability_zone;
+
+-- Create a table using the case-sensitive zone name
+CREATE TABLE IF NOT EXISTS employee (
+  emp_id INT PRIMARY KEY,
+  dept_id INT,
+  emp_name VARCHAR,
+  salary DECIMAL
+) ZONE "my_example_zone";
+
+-- Show all distribution zones
+SELECT * FROM SYSTEM.ZONES;
+
+-- Show specific zone details
+SELECT * FROM SYSTEM.ZONES WHERE NAME = 'renamed_zone';

Review Comment:
   ```suggestion
   SELECT * FROM system.zones WHERE name = 'renamed_zone';
   ```



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-27135 Add distribution zone SQL example [ignite-3]

Posted by "ygerzhedovich (via GitHub)" <gi...@apache.org>.
ygerzhedovich commented on code in PR #7035:
URL: https://github.com/apache/ignite-3/pull/7035#discussion_r2556007156


##########
examples/sql/distribution-zones.sql:
##########
@@ -0,0 +1,77 @@
+-- Drop tables first (zones cannot be dropped while tables use them)
+DROP TABLE IF EXISTS person;
+DROP TABLE IF EXISTS department;
+DROP TABLE IF EXISTS employee;
+DROP TABLE IF EXISTS my_table;
+
+-- Drop distribution zones
+DROP ZONE IF EXISTS renamed_zone;
+DROP ZONE IF EXISTS "my_example_zone";
+DROP ZONE IF EXISTS auto_scale_up_zone;
+DROP ZONE IF EXISTS auto_scale_down_zone;
+DROP ZONE IF EXISTS high_availability_zone;
+
+-- Create a case-insensitive distribution zone (example_zone)
+CREATE ZONE IF NOT EXISTS example_zone STORAGE PROFILES['default'];
+
+-- Create a case-sensitive distribution zone ("my_example_zone")
+CREATE ZONE IF NOT EXISTS "my_example_zone" STORAGE PROFILES['default'];
+
+-- Create a zone that waits 300 seconds before adding new nodes
+CREATE ZONE IF NOT EXISTS auto_scale_up_zone (AUTO SCALE UP 300) STORAGE PROFILES['default'];
+
+-- Create a zone that waits 600 seconds before removing idle nodes
+CREATE ZONE IF NOT EXISTS auto_scale_down_zone (AUTO SCALE DOWN 600) STORAGE PROFILES['default'];
+
+-- The following example requires nodes to be configured with
+-- the 'storage' attribute set to 'SSD'. To configure node attributes,
+-- use the GridGain CLI or configuration files.
+-- CREATE ZONE IF NOT EXISTS ssd_only_zone (NODES FILTER '$[?(@.storage == "SSD")]') STORAGE PROFILES['default'];
+
+-- Create a zone with high availability mode and 5 replicas
+CREATE ZONE IF NOT EXISTS high_availability_zone (
+  REPLICAS 5,
+  CONSISTENCY MODE 'HIGH_AVAILABILITY'
+) STORAGE PROFILES['default'];
+
+-- Rename example_zone to renamed_zone
+ALTER ZONE IF EXISTS example_zone RENAME TO renamed_zone;
+
+-- Set the number of replicas for renamed_zone to 10
+ALTER ZONE IF EXISTS renamed_zone SET REPLICAS 10;
+
+-- Set multiple parameters at once: replicas, quorum size, and node filter
+ALTER ZONE IF EXISTS high_availability_zone SET (
+  REPLICAS 5,
+  QUORUM SIZE 3
+);
+
+-- Create a person table using the renamed zone
+CREATE TABLE IF NOT EXISTS person (
+  id INT PRIMARY KEY,
+  city_id INT,
+  name VARCHAR,
+  age INT,
+  company VARCHAR
+) ZONE renamed_zone;
+
+-- Create a department table using the high availability zone
+CREATE TABLE IF NOT EXISTS department (
+  dept_id INT PRIMARY KEY,
+  dept_name VARCHAR,
+  location VARCHAR
+) ZONE high_availability_zone;
+
+-- Create a table using the case-sensitive zone name
+CREATE TABLE IF NOT EXISTS employee (
+  emp_id INT PRIMARY KEY,
+  dept_id INT,
+  emp_name VARCHAR,
+  salary DECIMAL
+) ZONE "my_example_zone";
+
+-- Show all distribution zones
+SELECT * FROM SYSTEM.ZONES;

Review Comment:
   ```suggestion
   SELECT * FROM system.zones;
   ```



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org