This is an automated email from the ASF dual-hosted git repository.
arp pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new 0d1d7c8 HDDS-1499. OzoneManager Cache. (#798)
0d1d7c8 is described below
commit 0d1d7c86ec34fabc62c0e3844aca3733024bc172
Author: Bharat Viswanadham
AuthorDate: Sun May 19 19:23:02 2019 -0700
HDDS-1499. OzoneManager Cache. (#798)
---
.../java/org/apache/hadoop/utils/db/DBStore.java | 1 +
.../java/org/apache/hadoop/utils/db/RDBTable.java | 10 +-
.../java/org/apache/hadoop/utils/db/Table.java | 26 +++-
.../org/apache/hadoop/utils/db/TypedTable.java | 78 ++-
.../org/apache/hadoop/utils/db/cache/CacheKey.java | 56
.../apache/hadoop/utils/db/cache/CacheValue.java | 47 +++
.../apache/hadoop/utils/db/cache/EpochEntry.java | 74 +++
.../hadoop/utils/db/cache/PartialTableCache.java | 97 ++
.../apache/hadoop/utils/db/cache/TableCache.java | 63 +
.../apache/hadoop/utils/db/cache/package-info.java | 18 +++
.../hadoop/utils/db/TestTypedRDBTableStore.java| 82 +++-
.../utils/db/cache/TestPartialTableCache.java | 142 +
.../apache/hadoop/utils/db/cache/package-info.java | 22
.../hadoop/ozone/om/OmMetadataManagerImpl.java | 4 +-
14 files changed, 709 insertions(+), 11 deletions(-)
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/utils/db/DBStore.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/utils/db/DBStore.java
index 56166ab..9e0c4a4 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/utils/db/DBStore.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/utils/db/DBStore.java
@@ -44,6 +44,7 @@ public interface DBStore extends AutoCloseable {
*/
Table getTable(String name) throws IOException;
+
/**
* Gets an existing TableStore with implicit key/value conversion.
*
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/utils/db/RDBTable.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/utils/db/RDBTable.java
index 88b0411..7bbe9d9 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/utils/db/RDBTable.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/utils/db/RDBTable.java
@@ -22,6 +22,7 @@ package org.apache.hadoop.utils.db;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
+import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.hdfs.DFSUtil;
import org.rocksdb.ColumnFamilyHandle;
@@ -33,9 +34,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * RocksDB implementation of ozone metadata store.
+ * RocksDB implementation of ozone metadata store. This class should be only
+ * used as part of TypedTable as it's underlying implementation to access the
+ * metadata store content. All other user's using Table should use TypedTable.
*/
-public class RDBTable implements Table {
+@InterfaceAudience.Private
+class RDBTable implements Table {
private static final Logger LOG =
@@ -52,7 +56,7 @@ public class RDBTable implements Table {
* @param handle - ColumnFamily Handle.
* @param writeOptions - RocksDB write Options.
*/
- public RDBTable(RocksDB db, ColumnFamilyHandle handle,
+ RDBTable(RocksDB db, ColumnFamilyHandle handle,
WriteOptions writeOptions) {
this.db = db;
this.handle = handle;
diff --git
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/utils/db/Table.java
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/utils/db/Table.java
index 2f14e77..905a68b 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/utils/db/Table.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/utils/db/Table.java
@@ -21,8 +21,10 @@ package org.apache.hadoop.utils.db;
import java.io.IOException;
+import org.apache.commons.lang3.NotImplementedException;
import org.apache.hadoop.classification.InterfaceStability;
-
+import org.apache.hadoop.utils.db.cache.CacheKey;
+import org.apache.hadoop.utils.db.cache.CacheValue;
/**
* Interface for key-value store that stores ozone metadata. Ozone metadata is
* stored as key value pairs, both key and value are arbitrary byte arrays.
Each
@@ -98,6 +100,28 @@ public interface Table extends AutoCloseable {
String getName() throws IOException;
/**
+ * Add entry to the table cache.
+ *
+ * If the cacheKey already exists, it will override the entry.
+ * @param cacheKey
+ * @param cacheValue
+ */
+ default void addCacheEntry(CacheKey cacheKey,
+ CacheValue cacheValue) {
+throw new NotImplementedException("addCacheEntry is not implemented");
+ }
+
+ /**
+ * Removes all the entries from the table cache which are having epoch value
+ * less
+ * than or equal to specified epoch value.
+ * @param epoch
+ */
+ default void