ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [04/29] ignite git commit: IGNITE-6550 Added new snapshot WAL record type - Fixes #2795.
Date Mon, 09 Oct 2017 14:51:11 GMT
IGNITE-6550 Added new snapshot WAL record type - Fixes #2795.

Signed-off-by: Alexey Goncharuk <alexey.goncharuk@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b2a02958
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b2a02958
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b2a02958

Branch: refs/heads/ignite-5937
Commit: b2a0295894dbdeb638ac8f764549a724578322ac
Parents: e6e1ca9
Author: Dmitriy Govorukhin <dmitriy.govorukhin@gmail.com>
Authored: Wed Oct 4 18:59:40 2017 +0300
Committer: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Committed: Wed Oct 4 18:59:40 2017 +0300

----------------------------------------------------------------------
 .../ignite/internal/pagemem/wal/WALPointer.java |  4 +-
 .../pagemem/wal/record/SnapshotRecord.java      | 58 ++++++++++++++++++++
 .../internal/pagemem/wal/record/WALRecord.java  |  6 +-
 .../GridCacheDatabaseSharedManager.java         |  3 +
 .../cache/persistence/wal/FileWALPointer.java   |  3 +
 5 files changed, 71 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b2a02958/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/WALPointer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/WALPointer.java
b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/WALPointer.java
index 73321f1..7ca4aee 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/WALPointer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/WALPointer.java
@@ -17,10 +17,12 @@
 
 package org.apache.ignite.internal.pagemem.wal;
 
+import java.io.Serializable;
+
 /**
  *
  */
-public interface WALPointer {
+public interface WALPointer extends Serializable {
     /**
      * Pointer to the next record. Can be used only for original pointers obtained from WAL
manager.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/b2a02958/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/SnapshotRecord.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/SnapshotRecord.java
b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/SnapshotRecord.java
new file mode 100644
index 0000000..3c3a77b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/SnapshotRecord.java
@@ -0,0 +1,58 @@
+/*
+ * 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.pagemem.wal.record;
+
+/**
+ * Wal snapshot record.
+ */
+public class SnapshotRecord extends WALRecord {
+    /** Snapshot id. */
+    private long snapshotId;
+
+    /** Full snapshot or incremental. */
+    private boolean full;
+
+    /**
+     *
+     */
+    public SnapshotRecord(long snapshotId, boolean full) {
+        this.snapshotId = snapshotId;
+        this.full = full;
+    }
+
+    /**
+     *
+     */
+    public long getSnapshotId() {
+        return snapshotId;
+    }
+
+    /**
+     *
+     */
+    public boolean isFull() {
+        return full;
+    }
+
+    /**
+     *
+     */
+    @Override public RecordType type() {
+        return RecordType.SNAPSHOT;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b2a02958/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/WALRecord.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/WALRecord.java
b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/WALRecord.java
index 89f3c86..08bba1b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/WALRecord.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/WALRecord.java
@@ -163,8 +163,10 @@ public abstract class WALRecord {
         BTREE_META_PAGE_INIT_ROOT2,
 
         /** Partition destroy. */
-        PARTITION_DESTROY
-        ;
+        PARTITION_DESTROY,
+
+        /** Snapshot record. */
+        SNAPSHOT;
 
         /** */
         private static final RecordType[] VALS = RecordType.values();

http://git-wip-us.apache.org/repos/asf/ignite/blob/b2a02958/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
index 2d89942..33f065e 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
@@ -2383,6 +2383,9 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
                 return new Checkpoint(cpEntry, cpPages, curr);
             }
             else {
+                if (curr.nextSnapshot)
+                    cctx.wal().fsync(null);
+
                 if (printCheckpointStats) {
                     if (log.isInfoEnabled())
                         LT.info(log, String.format("Skipping checkpoint (no pages were modified)
[" +

http://git-wip-us.apache.org/repos/asf/ignite/blob/b2a02958/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWALPointer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWALPointer.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWALPointer.java
index 3716de2..4998700 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWALPointer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWALPointer.java
@@ -24,6 +24,9 @@ import org.apache.ignite.internal.util.typedef.internal.S;
  * File WAL pointer.
  */
 public class FileWALPointer implements WALPointer, Comparable<FileWALPointer> {
+    /** Serial version uid. */
+    private static final long serialVersionUID = 0L;
+
     /** Absolute WAL segment file index (incrementing counter) */
     private final long idx;
 


Mime
View raw message