You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by gu...@apache.org on 2024/11/06 08:45:19 UTC
(ozone) 01/01: 111
This is an automated email from the ASF dual-hosted git repository.
guohao1225 pushed a commit to branch rocksdb-compact
in repository https://gitbox.apache.org/repos/asf/ozone.git
commit 1e626f5d92740acc4236b83935cec5aaeb04c26a
Author: guohao1 <gu...@360.cn>
AuthorDate: Wed Nov 6 16:44:52 2024 +0800
111
---
.../hdds/utils/db/DeleteFirstCompactStrategy.java | 58 ++++++++++++++++++++++
.../hadoop/hdds/utils/db/RDBCompactStrategy.java | 12 +++++
.../hdds/utils/db/SmallFileCompactStrategy.java | 12 +++++
3 files changed, 82 insertions(+)
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/DeleteFirstCompactStrategy.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/DeleteFirstCompactStrategy.java
new file mode 100644
index 0000000000..8d0d17981d
--- /dev/null
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/DeleteFirstCompactStrategy.java
@@ -0,0 +1,58 @@
+package org.apache.hadoop.hdds.utils.db;
+
+import org.rocksdb.LiveFileMetaData;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.List;
+
+public class DeleteFirstCompactStrategy implements RDBCompactStrategy {
+
+ private static final Logger LOG =
+ LoggerFactory.getLogger(DeleteFirstCompactStrategy.class);
+
+ private RocksDatabase rocksDB;
+ private RocksDatabase.ColumnFamily columnFamily;
+
+ private double ratio;
+
+ public DeleteFirstCompactStrategy(RocksDatabase rocksDB,
+ RocksDatabase.ColumnFamily columnFamily) {
+ this.rocksDB = rocksDB;
+ this.columnFamily = columnFamily;
+ }
+
+
+
+
+ public boolean compactIfNeed() throws IOException {
+
+ List<LiveFileMetaData> liveFileMetaDataList =
+ rocksDB.getLiveFilesMetaData();
+
+ for (LiveFileMetaData file : liveFileMetaDataList) {
+
+ if (columnFamily.getName().equals(file.columnFamilyName())) {
+ file.numDeletions();
+ file.numEntries();
+
+ file.smallestKey();
+ file.largestKey();
+ }
+ }
+
+
+
+
+
+ return true;
+ }
+
+
+
+
+
+
+
+}
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBCompactStrategy.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBCompactStrategy.java
new file mode 100644
index 0000000000..cdf04fa2b4
--- /dev/null
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBCompactStrategy.java
@@ -0,0 +1,12 @@
+package org.apache.hadoop.hdds.utils.db;
+
+public interface RDBCompactStrategy {
+
+
+
+
+
+
+
+
+}
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/SmallFileCompactStrategy.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/SmallFileCompactStrategy.java
new file mode 100644
index 0000000000..eb32b2c79e
--- /dev/null
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/SmallFileCompactStrategy.java
@@ -0,0 +1,12 @@
+package org.apache.hadoop.hdds.utils.db;
+
+public class SmallFileCompactStrategy implements RDBCompactStrategy {
+
+
+
+
+
+
+
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org