You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "korlov42 (via GitHub)" <gi...@apache.org> on 2023/09/01 05:54:36 UTC
[GitHub] [ignite-3] korlov42 opened a new pull request, #2530: IGNITE-20016 Introduce bulk operation to catalog
korlov42 opened a new pull request, #2530:
URL: https://github.com/apache/ignite-3/pull/2530
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
[GitHub] [ignite-3] zstan commented on a diff in pull request #2530: IGNITE-20016 Introduce bulk operation to catalog
Posted by "zstan (via GitHub)" <gi...@apache.org>.
zstan commented on code in PR #2530:
URL: https://github.com/apache/ignite-3/pull/2530#discussion_r1312876600
##########
modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogManagerSelfTest.java:
##########
@@ -1703,6 +1704,68 @@ void exceptionIsThrownIfCommandIsUnknown() {
IllegalArgumentException.class,
() -> manager.execute(command)
);
+
+ assertThrows(
+ IllegalArgumentException.class,
+ () -> manager.execute(List.of(
+ simpleTable("T1"),
+ simpleTable("T2"),
+ simpleTable("T3"),
+ command,
+ simpleTable("T4")
+ ))
+ );
+ }
+
+ @Test
+ void bulkCommandEitherAppliedAtomicallyOrDoesntAppliedAtAll() {
+ String tableName1 = "TEST1";
+ String tableName2 = "TEST2";
+ String tableName3 = "TEST1"; // intentional name conflict with table1
+
+ List<CatalogCommand> bulkUpdate = List.of(
+ simpleTable(tableName1),
+ simpleTable(tableName2),
+ simpleTable(tableName3)
+ );
+
+ assertThat(manager.table(tableName1, Long.MAX_VALUE), nullValue());
+ assertThat(manager.table(tableName2, Long.MAX_VALUE), nullValue());
+ assertThat(manager.table(tableName3, Long.MAX_VALUE), nullValue());
+
+ assertThat(manager.execute(bulkUpdate), willThrowFast(TableExistsValidationException.class));
+
+ // now let's truncate problematic table and retry
+ assertThat(manager.execute(bulkUpdate.subList(0, bulkUpdate.size() - 1)), willCompleteSuccessfully());
+
+ assertThat(manager.table(tableName1, Long.MAX_VALUE), notNullValue());
+ assertThat(manager.table(tableName2, Long.MAX_VALUE), notNullValue());
+ }
+
+ @Test
+ void bulkUpdateIncrementsVersionByOne() {
Review Comment:
yep, i check and seems there is no such a tests
--
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
[GitHub] [ignite-3] korlov42 commented on a diff in pull request #2530: IGNITE-20016 Introduce bulk operation to catalog
Posted by "korlov42 (via GitHub)" <gi...@apache.org>.
korlov42 commented on code in PR #2530:
URL: https://github.com/apache/ignite-3/pull/2530#discussion_r1312865605
##########
modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogManagerSelfTest.java:
##########
@@ -1703,6 +1704,68 @@ void exceptionIsThrownIfCommandIsUnknown() {
IllegalArgumentException.class,
() -> manager.execute(command)
);
+
+ assertThrows(
+ IllegalArgumentException.class,
+ () -> manager.execute(List.of(
+ simpleTable("T1"),
+ simpleTable("T2"),
+ simpleTable("T3"),
+ command,
+ simpleTable("T4")
+ ))
+ );
+ }
+
+ @Test
+ void bulkCommandEitherAppliedAtomicallyOrDoesntAppliedAtAll() {
+ String tableName1 = "TEST1";
+ String tableName2 = "TEST2";
+ String tableName3 = "TEST1"; // intentional name conflict with table1
+
+ List<CatalogCommand> bulkUpdate = List.of(
+ simpleTable(tableName1),
+ simpleTable(tableName2),
+ simpleTable(tableName3)
+ );
+
+ assertThat(manager.table(tableName1, Long.MAX_VALUE), nullValue());
+ assertThat(manager.table(tableName2, Long.MAX_VALUE), nullValue());
+ assertThat(manager.table(tableName3, Long.MAX_VALUE), nullValue());
+
+ assertThat(manager.execute(bulkUpdate), willThrowFast(TableExistsValidationException.class));
+
+ // now let's truncate problematic table and retry
+ assertThat(manager.execute(bulkUpdate.subList(0, bulkUpdate.size() - 1)), willCompleteSuccessfully());
+
+ assertThat(manager.table(tableName1, Long.MAX_VALUE), notNullValue());
+ assertThat(manager.table(tableName2, Long.MAX_VALUE), notNullValue());
+ }
+
+ @Test
+ void bulkUpdateIncrementsVersionByOne() {
Review Comment:
did you mean test on bulk operations in case of error does not increment catalog version?
--
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
[GitHub] [ignite-3] korlov42 commented on a diff in pull request #2530: IGNITE-20016 Introduce bulk operation to catalog
Posted by "korlov42 (via GitHub)" <gi...@apache.org>.
korlov42 commented on code in PR #2530:
URL: https://github.com/apache/ignite-3/pull/2530#discussion_r1312893097
##########
modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogManagerSelfTest.java:
##########
@@ -1703,6 +1704,68 @@ void exceptionIsThrownIfCommandIsUnknown() {
IllegalArgumentException.class,
() -> manager.execute(command)
);
+
+ assertThrows(
+ IllegalArgumentException.class,
+ () -> manager.execute(List.of(
+ simpleTable("T1"),
+ simpleTable("T2"),
+ simpleTable("T3"),
+ command,
+ simpleTable("T4")
+ ))
+ );
+ }
+
+ @Test
+ void bulkCommandEitherAppliedAtomicallyOrDoesntAppliedAtAll() {
+ String tableName1 = "TEST1";
+ String tableName2 = "TEST2";
+ String tableName3 = "TEST1"; // intentional name conflict with table1
+
+ List<CatalogCommand> bulkUpdate = List.of(
+ simpleTable(tableName1),
+ simpleTable(tableName2),
+ simpleTable(tableName3)
+ );
+
+ assertThat(manager.table(tableName1, Long.MAX_VALUE), nullValue());
+ assertThat(manager.table(tableName2, Long.MAX_VALUE), nullValue());
+ assertThat(manager.table(tableName3, Long.MAX_VALUE), nullValue());
+
+ assertThat(manager.execute(bulkUpdate), willThrowFast(TableExistsValidationException.class));
+
+ // now let's truncate problematic table and retry
+ assertThat(manager.execute(bulkUpdate.subList(0, bulkUpdate.size() - 1)), willCompleteSuccessfully());
+
+ assertThat(manager.table(tableName1, Long.MAX_VALUE), notNullValue());
+ assertThat(manager.table(tableName2, Long.MAX_VALUE), notNullValue());
+ }
+
+ @Test
+ void bulkUpdateIncrementsVersionByOne() {
Review Comment:
test has been added
--
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
[GitHub] [ignite-3] korlov42 commented on a diff in pull request #2530: IGNITE-20016 Introduce bulk operation to catalog
Posted by "korlov42 (via GitHub)" <gi...@apache.org>.
korlov42 commented on code in PR #2530:
URL: https://github.com/apache/ignite-3/pull/2530#discussion_r1312863671
##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/CatalogManager.java:
##########
@@ -49,6 +50,20 @@ public interface CatalogManager extends IgniteComponent, CatalogService {
*/
CompletableFuture<Void> execute(CatalogCommand command) throws IllegalArgumentException;
+ /**
+ * Executes given list of commands atomically. That is, either all commands will be applied at once
+ * or neither of them. The whole bulk will increment catalog's version by a single point.
+ *
+ * <p>Accepts only those commands provided by builders returned by this very {@link CatalogManager}.
Review Comment:
[here](https://english.stackexchange.com/questions/113382/difference-between-this-very-and-this-particular) is a good explanation of this very ( 😉 ) construction
##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/CatalogManager.java:
##########
@@ -49,6 +50,20 @@ public interface CatalogManager extends IgniteComponent, CatalogService {
*/
CompletableFuture<Void> execute(CatalogCommand command) throws IllegalArgumentException;
+ /**
+ * Executes given list of commands atomically. That is, either all commands will be applied at once
+ * or neither of them. The whole bulk will increment catalog's version by a single point.
+ *
+ * <p>Accepts only those commands provided by builders returned by this very {@link CatalogManager}.
Review Comment:
[here](https://english.stackexchange.com/questions/113382/difference-between-this-very-and-this-particular) is a good explanation of this very ( 😉 ) construction
--
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
[GitHub] [ignite-3] korlov42 merged pull request #2530: IGNITE-20016 Introduce bulk operation to catalog
Posted by "korlov42 (via GitHub)" <gi...@apache.org>.
korlov42 merged PR #2530:
URL: https://github.com/apache/ignite-3/pull/2530
--
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
[GitHub] [ignite-3] zstan commented on a diff in pull request #2530: IGNITE-20016 Introduce bulk operation to catalog
Posted by "zstan (via GitHub)" <gi...@apache.org>.
zstan commented on code in PR #2530:
URL: https://github.com/apache/ignite-3/pull/2530#discussion_r1312832490
##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/CatalogManager.java:
##########
@@ -49,6 +50,20 @@ public interface CatalogManager extends IgniteComponent, CatalogService {
*/
CompletableFuture<Void> execute(CatalogCommand command) throws IllegalArgumentException;
+ /**
+ * Executes given list of commands atomically. That is, either all commands will be applied at once
+ * or neither of them. The whole bulk will increment catalog's version by a single point.
+ *
+ * <p>Accepts only those commands provided by builders returned by this very {@link CatalogManager}.
Review Comment:
"by this very" ? Don`t understand it.
##########
modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogManagerSelfTest.java:
##########
@@ -1703,6 +1704,68 @@ void exceptionIsThrownIfCommandIsUnknown() {
IllegalArgumentException.class,
() -> manager.execute(command)
);
+
+ assertThrows(
+ IllegalArgumentException.class,
+ () -> manager.execute(List.of(
+ simpleTable("T1"),
+ simpleTable("T2"),
+ simpleTable("T3"),
+ command,
+ simpleTable("T4")
+ ))
+ );
+ }
+
+ @Test
+ void bulkCommandEitherAppliedAtomicallyOrDoesntAppliedAtAll() {
+ String tableName1 = "TEST1";
+ String tableName2 = "TEST2";
+ String tableName3 = "TEST1"; // intentional name conflict with table1
+
+ List<CatalogCommand> bulkUpdate = List.of(
+ simpleTable(tableName1),
+ simpleTable(tableName2),
+ simpleTable(tableName3)
+ );
+
+ assertThat(manager.table(tableName1, Long.MAX_VALUE), nullValue());
+ assertThat(manager.table(tableName2, Long.MAX_VALUE), nullValue());
+ assertThat(manager.table(tableName3, Long.MAX_VALUE), nullValue());
+
+ assertThat(manager.execute(bulkUpdate), willThrowFast(TableExistsValidationException.class));
+
+ // now let's truncate problematic table and retry
+ assertThat(manager.execute(bulkUpdate.subList(0, bulkUpdate.size() - 1)), willCompleteSuccessfully());
+
+ assertThat(manager.table(tableName1, Long.MAX_VALUE), notNullValue());
+ assertThat(manager.table(tableName2, Long.MAX_VALUE), notNullValue());
+ }
+
+ @Test
+ void bulkUpdateIncrementsVersionByOne() {
Review Comment:
do we need such a test for erroneous operation ? How it was demonstrated in _bulkCommandEitherAppliedAtomicallyOrDoesntAppliedAtAll_ ?
##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/CatalogManagerImpl.java:
##########
@@ -313,12 +313,27 @@ private Catalog catalogAt(long timestamp) {
@Override
public CompletableFuture<Void> execute(CatalogCommand command) {
+ return saveUpdateAndWaitForActivation(toProducerOrThrow(command));
+ }
+
+ @Override
+ public CompletableFuture<Void> execute(List<CatalogCommand> commands) throws IllegalArgumentException {
+ List<UpdateProducer> producers = new ArrayList<>(commands.size());
+
+ for (CatalogCommand command : commands) {
+ producers.add(toProducerOrThrow(command));
+ }
+
+ return saveUpdateAndWaitForActivation(new BulkUpdateProducer(producers));
+ }
+
+ private static UpdateProducer toProducerOrThrow(CatalogCommand command) {
if (!(command instanceof UpdateProducer)) {
throw new IllegalArgumentException("Expected command created by this very manager, but got "
Review Comment:
"very manager" - also strange for me.
--
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