NSAmelchev commented on a change in pull request #8904:
URL: https://github.com/apache/ignite/pull/8904#discussion_r599878637
##########
File path:
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/reader/IgniteWalReaderTest.java
##########
@@ -996,6 +1007,89 @@ private void runRemoveOperationTest(CacheAtomicityMode
mode) throws Exception {
deletesFound != null && deletesFound > 0);
}
+ /**
+ * Tests transaction generation and WAL for putAll cache operation.
+ *
+ * @throws Exception if failed.
+ */
+ @Test
+ public void testPrimaryFlagOnTwoNodes() throws Exception {
+ backupCnt = 1;
+
+ IgniteEx ignite = startGrid("node0");
+ Ignite ignite1 = startGrid(1);
+
+ ignite.cluster().state(ACTIVE);
+
+ IgniteCache<Integer, IndexedObject> cache = ignite.cache(CACHE_NAME);
+
+ backupCnt = 0;
+
+ int cntEntries = 100;
+
+ List<Integer> keys = findKeys(ignite.localNode(), cache, cntEntries,
0, 0);
+
+ Map<Integer, IndexedObject> map = new TreeMap<>();
+
+ for (Integer key : keys)
+ map.putIfAbsent(key, new IndexedObject(key));
+
+ cache.putAll(map);
+
+ ignite.cluster().active(false);
+
+ String subfolderName1 = genDbSubfolderName(ignite, 0);
+ String subfolderName2 = genDbSubfolderName(ignite1, 1);
+
+ stopAllGrids();
+
+ String workDir = U.defaultWorkDirectory();
+
+ IgniteWalIteratorFactory factory = new IgniteWalIteratorFactory(log);
+
+ Map<GridCacheOperation, Integer> operationsFound = new
EnumMap<>(GridCacheOperation.class);
+
+ IgniteInClosure<DataRecord> drHnd = dataRecord -> {
+ List<? extends DataEntry> entries = dataRecord.writeEntries();
+
+ for (DataEntry entry : entries) {
+ GridCacheOperation op = entry.op();
+ Integer cnt = operationsFound.get(op);
+
+ operationsFound.put(op, cnt == null ? 1 : (cnt + 1));
+ }
+ };
+
+ scanIterateAndCount(
+ factory,
+ createIteratorParametersBuilder(workDir, subfolderName1)
+ .filesOrDirs(
+ workDir + "/db/wal/" + subfolderName1,
+ workDir + "/db/wal/archive/" + subfolderName1
+ ),
+ 1,
+ 1,
+ null, drHnd
+ );
+
+ primary = false;
+
+ scanIterateAndCount(
+ factory,
+ createIteratorParametersBuilder(workDir, subfolderName2)
+ .filesOrDirs(
+ workDir + "/db/wal/" + subfolderName2,
+ workDir + "/db/wal/archive/" + subfolderName2
+ ),
+ 1,
+ 1,
+ null,
+ drHnd
+ );
+
+ primary = true;
Review comment:
This is unnecessary
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]