You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "tkalkirill (via GitHub)" <gi...@apache.org> on 2023/11/15 09:48:58 UTC
[PR] IGNITE-20860 Сheck the correctness of the catalog version recovery [ignite-3]
tkalkirill opened a new pull request, #2841:
URL: https://github.com/apache/ignite-3/pull/2841
https://issues.apache.org/jira/browse/IGNITE-20860
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-20860 Сheck the correctness of the catalog version recovery [ignite-3]
Posted by "tkalkirill (via GitHub)" <gi...@apache.org>.
tkalkirill commented on code in PR #2841:
URL: https://github.com/apache/ignite-3/pull/2841#discussion_r1394065865
##########
modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogManagerRecoveryTest.java:
##########
@@ -0,0 +1,131 @@
+/*
+ * 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.internal.catalog;
+
+import static org.apache.ignite.internal.catalog.BaseCatalogManagerTest.INDEX_NAME;
+import static org.apache.ignite.internal.catalog.BaseCatalogManagerTest.TABLE_NAME;
+import static org.apache.ignite.internal.catalog.BaseCatalogManagerTest.simpleIndex;
+import static org.apache.ignite.internal.catalog.BaseCatalogManagerTest.simpleTable;
+import static org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willCompleteSuccessfully;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.greaterThan;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.nio.file.Path;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Stream;
+import org.apache.ignite.internal.hlc.HybridClock;
+import org.apache.ignite.internal.hlc.HybridClockImpl;
+import org.apache.ignite.internal.hlc.HybridTimestamp;
+import org.apache.ignite.internal.manager.IgniteComponent;
+import org.apache.ignite.internal.metastorage.MetaStorageManager;
+import org.apache.ignite.internal.metastorage.impl.StandaloneMetaStorageManager;
+import org.apache.ignite.internal.metastorage.server.KeyValueStorage;
+import org.apache.ignite.internal.metastorage.server.TestRocksDbKeyValueStorage;
+import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest;
+import org.apache.ignite.internal.testframework.WorkDirectory;
+import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.vault.VaultManager;
+import org.apache.ignite.internal.vault.inmemory.InMemoryVaultService;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+/** For {@link CatalogManager} testing on recovery. */
+@ExtendWith(WorkDirectoryExtension.class)
+public class CatalogManagerRecoveryTest extends BaseIgniteAbstractTest {
+ private static final String NODE_NAME = "test-node-name";
+
+ @WorkDirectory
+ private Path workDir;
+
+ private final HybridClock clock = new HybridClockImpl();
+
+ private final VaultManager vaultManager = new VaultManager(new InMemoryVaultService());
+
+ private MetaStorageManager metaStorageManager;
+
+ private CatalogManager catalogManager;
+
+ @AfterEach
+ void tearDown() throws Exception {
+ IgniteUtils.stopAll(catalogManager, metaStorageManager, vaultManager);
+ }
+
+ @Test
+ void testRecoveryCatalogVersionTimestamps() throws Exception {
+ createAndStartComponents();
+
+ // Let's create a couple of versions of the catalog.
+ assertThat(catalogManager.execute(simpleTable(TABLE_NAME)), willCompleteSuccessfully());
+
+ int catalogVersion0 = catalogManager.latestCatalogVersion();
+
+ assertThat(catalogManager.execute(simpleIndex(TABLE_NAME, INDEX_NAME)), willCompleteSuccessfully());
+
+ int catalogVersion1 = catalogManager.latestCatalogVersion();
+
+ assertThat(catalogVersion1, greaterThan(catalogVersion0));
+
+ long time0 = catalogManager.catalog(catalogVersion0).time();
+ long time1 = catalogManager.catalog(catalogVersion1).time();
+
+ assertThat(time1, greaterThan(time0));
+
+ // We will restart and recover the components and also set the clock to the future.
+ stopComponents();
+
+ HybridTimestamp updateNow = clock.now().addPhysicalTime(TimeUnit.DAYS.toMillis(1));
+ clock.update(updateNow);
+
+ HybridTimestamp newNow = clock.now();
+ assertTrue(newNow.compareTo(updateNow) > 0, "updateNow=" + updateNow + ", newNow=" + newNow);
Review Comment:
why not
--
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-20860 Сheck the correctness of the catalog version recovery [ignite-3]
Posted by "rpuch (via GitHub)" <gi...@apache.org>.
rpuch commented on code in PR #2841:
URL: https://github.com/apache/ignite-3/pull/2841#discussion_r1394023176
##########
modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogManagerRecoveryTest.java:
##########
@@ -0,0 +1,131 @@
+/*
+ * 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.internal.catalog;
+
+import static org.apache.ignite.internal.catalog.BaseCatalogManagerTest.INDEX_NAME;
+import static org.apache.ignite.internal.catalog.BaseCatalogManagerTest.TABLE_NAME;
+import static org.apache.ignite.internal.catalog.BaseCatalogManagerTest.simpleIndex;
+import static org.apache.ignite.internal.catalog.BaseCatalogManagerTest.simpleTable;
+import static org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willCompleteSuccessfully;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.greaterThan;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.nio.file.Path;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Stream;
+import org.apache.ignite.internal.hlc.HybridClock;
+import org.apache.ignite.internal.hlc.HybridClockImpl;
+import org.apache.ignite.internal.hlc.HybridTimestamp;
+import org.apache.ignite.internal.manager.IgniteComponent;
+import org.apache.ignite.internal.metastorage.MetaStorageManager;
+import org.apache.ignite.internal.metastorage.impl.StandaloneMetaStorageManager;
+import org.apache.ignite.internal.metastorage.server.KeyValueStorage;
+import org.apache.ignite.internal.metastorage.server.TestRocksDbKeyValueStorage;
+import org.apache.ignite.internal.testframework.BaseIgniteAbstractTest;
+import org.apache.ignite.internal.testframework.WorkDirectory;
+import org.apache.ignite.internal.testframework.WorkDirectoryExtension;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.vault.VaultManager;
+import org.apache.ignite.internal.vault.inmemory.InMemoryVaultService;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+/** For {@link CatalogManager} testing on recovery. */
+@ExtendWith(WorkDirectoryExtension.class)
+public class CatalogManagerRecoveryTest extends BaseIgniteAbstractTest {
+ private static final String NODE_NAME = "test-node-name";
+
+ @WorkDirectory
+ private Path workDir;
+
+ private final HybridClock clock = new HybridClockImpl();
+
+ private final VaultManager vaultManager = new VaultManager(new InMemoryVaultService());
+
+ private MetaStorageManager metaStorageManager;
+
+ private CatalogManager catalogManager;
+
+ @AfterEach
+ void tearDown() throws Exception {
+ IgniteUtils.stopAll(catalogManager, metaStorageManager, vaultManager);
+ }
+
+ @Test
+ void testRecoveryCatalogVersionTimestamps() throws Exception {
+ createAndStartComponents();
+
+ // Let's create a couple of versions of the catalog.
+ assertThat(catalogManager.execute(simpleTable(TABLE_NAME)), willCompleteSuccessfully());
+
+ int catalogVersion0 = catalogManager.latestCatalogVersion();
+
+ assertThat(catalogManager.execute(simpleIndex(TABLE_NAME, INDEX_NAME)), willCompleteSuccessfully());
+
+ int catalogVersion1 = catalogManager.latestCatalogVersion();
+
+ assertThat(catalogVersion1, greaterThan(catalogVersion0));
+
+ long time0 = catalogManager.catalog(catalogVersion0).time();
+ long time1 = catalogManager.catalog(catalogVersion1).time();
+
+ assertThat(time1, greaterThan(time0));
+
+ // We will restart and recover the components and also set the clock to the future.
+ stopComponents();
+
+ HybridTimestamp updateNow = clock.now().addPhysicalTime(TimeUnit.DAYS.toMillis(1));
+ clock.update(updateNow);
+
+ HybridTimestamp newNow = clock.now();
+ assertTrue(newNow.compareTo(updateNow) > 0, "updateNow=" + updateNow + ", newNow=" + newNow);
Review Comment:
Can `assertThat(newNow, greaterThan(updateNow))` be used here?
--
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-20860 Сheck the correctness of the catalog version recovery [ignite-3]
Posted by "tkalkirill (via GitHub)" <gi...@apache.org>.
tkalkirill merged PR #2841:
URL: https://github.com/apache/ignite-3/pull/2841
--
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