hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bha...@apache.org
Subject [33/37] hadoop git commit: HDDS-237. Add updateDeleteTransactionId. Contributed by Bharat Viswanadham and Lokesh Jain
Date Mon, 09 Jul 2018 20:33:42 GMT
HDDS-237. Add updateDeleteTransactionId. Contributed by Bharat Viswanadham and Lokesh Jain


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

Branch: refs/heads/trunk
Commit: cb9574a337f2012f2ab59c2abf300567562bf3a3
Parents: e899c4c
Author: Bharat Viswanadham <bharat@apache.org>
Authored: Fri Jul 6 16:26:40 2018 -0700
Committer: Bharat Viswanadham <bharat@apache.org>
Committed: Fri Jul 6 16:26:40 2018 -0700

----------------------------------------------------------------------
 .../container/common/impl/ContainerData.java    | 21 ++++++++++++++++++++
 .../container/common/interfaces/Container.java  |  6 ++++++
 .../container/keyvalue/KeyValueContainer.java   |  5 +++++
 3 files changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/cb9574a3/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerData.java
----------------------------------------------------------------------
diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerData.java
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerData.java
index 5638b60..0d217e4 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerData.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerData.java
@@ -32,6 +32,8 @@ import java.util.TreeMap;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 
+import static java.lang.Math.max;
+
 /**
  * ContainerData is the in-memory representation of container metadata and is
  * represented on disk by the .container file.
@@ -70,6 +72,8 @@ public class ContainerData {
 
   private HddsVolume volume;
 
+  private long deleteTransactionId;
+
   /**
    * Number of pending deletion blocks in container.
    */
@@ -110,6 +114,7 @@ public class ContainerData {
     this.keyCount = new AtomicLong(0L);
     this.maxSizeGB = size;
     this.numPendingDeletionBlocks = new AtomicInteger(0);
+    this.deleteTransactionId = 0;
   }
 
   /**
@@ -441,4 +446,20 @@ public class ContainerData {
 
     return builder.build();
   }
+
+  /**
+   * Sets deleteTransactionId to latest delete transactionId for the container.
+   *
+   * @param transactionId latest transactionId of the container.
+   */
+  public void updateDeleteTransactionId(long transactionId) {
+    deleteTransactionId = max(transactionId, deleteTransactionId);
+  }
+
+  /**
+   * Return the latest deleteTransactionId of the container.
+   */
+  public long getDeleteTransactionId() {
+    return deleteTransactionId;
+  }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/cb9574a3/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/interfaces/Container.java
----------------------------------------------------------------------
diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/interfaces/Container.java
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/interfaces/Container.java
index f0f1b37..03ed7b1 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/interfaces/Container.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/interfaces/Container.java
@@ -91,4 +91,10 @@ public interface Container extends RwLock {
    */
   ContainerProtos.ContainerType getContainerType();
 
+  /**
+   * updates the DeleteTransactionId.
+   * @param deleteTransactionId
+   */
+  void updateDeleteTransactionId(long deleteTransactionId);
+
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/cb9574a3/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueContainer.java
----------------------------------------------------------------------
diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueContainer.java
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueContainer.java
index 95621e5..b07b053 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueContainer.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueContainer.java
@@ -415,6 +415,11 @@ public class KeyValueContainer implements Container {
     }
   }
 
+  @Override
+  public void updateDeleteTransactionId(long deleteTransactionId) {
+    containerData.updateDeleteTransactionId(deleteTransactionId);
+  }
+
   /**
    * Acquire read lock.
    */


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message