timoninmaxim commented on code in PR #11040:
URL: https://github.com/apache/ignite/pull/11040#discussion_r1397505997
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/dump/CreateDumpFutureTask.java:
##########
@@ -444,10 +451,7 @@ public PartitionDumpContext(CacheGroupContext gctx, int
part, ConcurrentMap<Long
for (int cache : gctx.cacheIds())
changed.put(cache, new GridConcurrentHashSet<>());
- File dumpFile = new File(groupDirectory(gctx),
PART_FILE_PREFIX + part + DUMP_FILE_EXT);
-
- if (!dumpFile.createNewFile())
Review Comment:
Why did you remove this check?
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/dump/WriteOnlyZipFileIO.java:
##########
@@ -0,0 +1,160 @@
+/*
+ * 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.processors.cache.persistence.snapshot.dump;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.Channels;
+import java.nio.channels.WritableByteChannel;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+import
org.apache.ignite.internal.processors.cache.persistence.file.AbstractFileIO;
+import org.apache.ignite.internal.processors.cache.persistence.file.FileIO;
+import org.apache.ignite.internal.util.typedef.internal.A;
+
+import static
org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.ZIP_SUFFIX;
+
+/**
+ * {@link FileIO} that allows to write ZIP compressed file.
+ * It doesn't support reading or random access.
+ * It is not designed for multithreaded writing.
Review Comment:
But it's used in concurrent environment? WriteOnlyZipFileIO is shared
between multiple PartitionDumpContext's.
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotHandlerContext.java:
##########
@@ -32,6 +32,9 @@ public class SnapshotHandlerContext {
/** The full path to the snapshot files. */
private final File snpDir;
+ /** If {@code true} then compress the files. */
+ private final boolean compress;
Review Comment:
Can extract it from metadata?
##########
modules/core/src/main/java/org/apache/ignite/dump/DumpReader.java:
##########
@@ -101,6 +101,9 @@ public DumpReader(DumpReaderConfiguration cfg, IgniteLogger
log) {
}
}
+ Map<String, Boolean> compressions = dump.metadata().stream()
Review Comment:
I suppose the compression value should be the same for all cache groups
within a dump?
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/dump/CreateDumpFutureTask.java:
##########
@@ -93,6 +94,9 @@ public class CreateDumpFutureTask extends
AbstractCreateSnapshotFutureTask imple
/** */
private final FileIOFactory ioFactory;
+ /** */
Review Comment:
Missed javadoc
##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/SnapshotMetadata.java:
##########
@@ -63,6 +63,9 @@ public class SnapshotMetadata implements Serializable {
*/
private final String folderName;
+ /** If {@code true} then compress the files. */
+ private final boolean compress;
Review Comment:
There is already `compGrpIds`. But its compression differs from dump
compression. Let's name this param in different way?
--
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]