geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dschnei...@apache.org
Subject geode git commit: GEODE-2801: change krfIds to be thread safe
Date Thu, 20 Apr 2017 00:09:40 GMT
Repository: geode
Updated Branches:
  refs/heads/feature/GEODE-2801 [created] 9e5b10b3b


GEODE-2801: change krfIds to be thread safe


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

Branch: refs/heads/feature/GEODE-2801
Commit: 9e5b10b3b9b37929f5309a8918de33fa72ad6f3c
Parents: aaef124
Author: Darrel Schneider <dschneider@pivotal.io>
Authored: Wed Apr 19 17:09:05 2017 -0700
Committer: Darrel Schneider <dschneider@pivotal.io>
Committed: Wed Apr 19 17:09:05 2017 -0700

----------------------------------------------------------------------
 .../org/apache/geode/internal/cache/DiskInitFile.java     | 10 +++++++---
 .../main/java/org/apache/geode/internal/cache/Oplog.java  |  1 +
 2 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/9e5b10b3/geode-core/src/main/java/org/apache/geode/internal/cache/DiskInitFile.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskInitFile.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskInitFile.java
index f6bf17f..0925d28 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskInitFile.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskInitFile.java
@@ -48,6 +48,7 @@ import org.apache.geode.internal.cache.persistence.PersistentMemberPattern;
 import org.apache.geode.internal.cache.versions.DiskRegionVersionVector;
 import org.apache.geode.internal.cache.versions.RegionVersionHolder;
 import org.apache.geode.internal.cache.versions.RegionVersionVector;
+import org.apache.geode.internal.concurrent.ConcurrentHashSet;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.internal.logging.log4j.LogMarker;
@@ -72,6 +73,7 @@ import java.util.Collections;
 import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
@@ -331,7 +333,9 @@ public class DiskInitFile implements DiskInitFileInterpreter {
 
   private final LongOpenHashSet crfIds;
   private final LongOpenHashSet drfIds;
-  private final LongOpenHashSet krfIds;
+  // krfIds uses a concurrent impl because backup
+  // can call hasKrf concurrently with cmnKrfCreate
+  private final ConcurrentHashSet<Long> krfIds;
 
   /**
    * Map used to keep track of regions we know of from the DiskInitFile but that do not yet
exist
@@ -1611,7 +1615,7 @@ public class DiskInitFile implements DiskInitFileInterpreter {
   }
 
   private void saveKrfIds() {
-    for (LongIterator i = this.krfIds.iterator(); i.hasNext();) {
+    for (Iterator<Long> i = this.krfIds.iterator(); i.hasNext();) {
       writeIFRecord(IFREC_KRF_CREATE, i.next());
       this.ifLiveRecordCount++;
       this.ifTotalRecordCount++;
@@ -1879,7 +1883,7 @@ public class DiskInitFile implements DiskInitFileInterpreter {
     this.instIds = new IntOpenHashSet();
     this.crfIds = new LongOpenHashSet();
     this.drfIds = new LongOpenHashSet();
-    this.krfIds = new LongOpenHashSet();
+    this.krfIds = new ConcurrentHashSet<>();
     recover();
     if (this.parent.isOffline() && !this.parent.isOfflineCompacting()
         && !this.parent.isOfflineModify()) {

http://git-wip-us.apache.org/repos/asf/geode/blob/9e5b10b3/geode-core/src/main/java/org/apache/geode/internal/cache/Oplog.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/Oplog.java b/geode-core/src/main/java/org/apache/geode/internal/cache/Oplog.java
index ca9468d..ddf92f2 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/Oplog.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/Oplog.java
@@ -5814,6 +5814,7 @@ public final class Oplog implements CompactableOplog, Flushable {
     }
 
     // this krf existence check fixes 45089
+    // TODO: should we wait for the async KRF creation to finish by calling this.finishKrf?

     if (getParent().getDiskInitFile().hasKrf(this.oplogId)) {
       if (this.getKrfFile().exists()) {
         FileUtils.copyFileToDirectory(this.getKrfFile(), targetDir);


Mime
View raw message