tkalkirill commented on code in PR #1405:
URL: https://github.com/apache/ignite-3/pull/1405#discussion_r1047622862
##########
modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvPartitionStorageTest.java:
##########
@@ -105,7 +121,94 @@ void testReadAfterRestart() throws Exception {
tearDown();
setUp();
+ }
- assertRowMatches(binaryRow, read(rowId, HybridTimestamp.MAX_VALUE));
+ @Test
+ void groupConfigIsPersisted() throws Exception {
+ RaftGroupConfiguration originalConfig = new RaftGroupConfiguration(
+ List.of("peer1", "peer2"),
+ List.of("old-peer1", "old-peer2"),
+ List.of("learner1", "learner2"),
+ List.of("old-learner1", "old-learner2")
+ );
+
+ storage.runConsistently(() -> {
+ storage.committedGroupConfiguration(originalConfig);
+
+ return null;
+ });
+
+ restartStorage();
+
+ RaftGroupConfiguration readConfig =
storage.committedGroupConfiguration();
+
+ assertThat(readConfig, is(equalTo(originalConfig)));
+ }
+
+ @Test
+ void groupConfigWhichDoesNotFitInOnePageIsPersisted() throws Exception {
+ List<String> oneMbOfPeers = IntStream.range(0, 100_000)
+ .mapToObj(n -> String.format("peer%06d", n))
+ .collect(toList());
+
+ RaftGroupConfiguration originalConfig = new RaftGroupConfiguration(
+ oneMbOfPeers,
+ List.of("old-peer1", "old-peer2"),
+ List.of("learner1", "learner2"),
+ List.of("old-learner1", "old-learner2")
+ );
+
+ storage.runConsistently(() -> {
+ storage.committedGroupConfiguration(originalConfig);
+
+ return null;
+ });
+
+ restartStorage();
+
+ RaftGroupConfiguration readConfig =
storage.committedGroupConfiguration();
+
+ assertThat(readConfig, is(equalTo(originalConfig)));
+ }
+
+ @Test
+ void groupConfigPagesAreRecycled() throws Exception {
+ List<String> oneMbOfPeers = IntStream.range(0, 100_000)
Review Comment:
I think it's worth making sure the size of these `Strings` is greater than
at least 2 pages.
##########
modules/storage-page-memory/src/test/java/org/apache/ignite/internal/storage/pagememory/mv/PersistentPageMemoryMvPartitionStorageTest.java:
##########
@@ -105,7 +121,94 @@ void testReadAfterRestart() throws Exception {
tearDown();
setUp();
+ }
- assertRowMatches(binaryRow, read(rowId, HybridTimestamp.MAX_VALUE));
+ @Test
+ void groupConfigIsPersisted() throws Exception {
+ RaftGroupConfiguration originalConfig = new RaftGroupConfiguration(
+ List.of("peer1", "peer2"),
+ List.of("old-peer1", "old-peer2"),
+ List.of("learner1", "learner2"),
+ List.of("old-learner1", "old-learner2")
+ );
+
+ storage.runConsistently(() -> {
+ storage.committedGroupConfiguration(originalConfig);
+
+ return null;
+ });
+
+ restartStorage();
+
+ RaftGroupConfiguration readConfig =
storage.committedGroupConfiguration();
+
+ assertThat(readConfig, is(equalTo(originalConfig)));
+ }
+
+ @Test
+ void groupConfigWhichDoesNotFitInOnePageIsPersisted() throws Exception {
+ List<String> oneMbOfPeers = IntStream.range(0, 100_000)
+ .mapToObj(n -> String.format("peer%06d", n))
+ .collect(toList());
+
+ RaftGroupConfiguration originalConfig = new RaftGroupConfiguration(
+ oneMbOfPeers,
+ List.of("old-peer1", "old-peer2"),
+ List.of("learner1", "learner2"),
+ List.of("old-learner1", "old-learner2")
+ );
+
+ storage.runConsistently(() -> {
+ storage.committedGroupConfiguration(originalConfig);
+
+ return null;
+ });
+
+ restartStorage();
+
+ RaftGroupConfiguration readConfig =
storage.committedGroupConfiguration();
+
+ assertThat(readConfig, is(equalTo(originalConfig)));
+ }
+
+ @Test
+ void groupConfigPagesAreRecycled() throws Exception {
+ List<String> oneMbOfPeers = IntStream.range(0, 100_000)
+ .mapToObj(n -> String.format("peer%06d", n))
+ .collect(toList());
+
+ RaftGroupConfiguration originalConfigOfMoreThanOnePage = new
RaftGroupConfiguration(
+ oneMbOfPeers,
+ List.of("old-peer1", "old-peer2"),
+ List.of("learner1", "learner2"),
+ List.of("old-learner1", "old-learner2")
+ );
+
+ storage.runConsistently(() -> {
+
storage.committedGroupConfiguration(originalConfigOfMoreThanOnePage);
+
+ return null;
+ });
+
+ long freeSpaceBeforeTrimming =
pageMemStorage.rowVersionFreeList.freeSpace();
Review Comment:
unused
--
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]