forked from apache/ozone
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
782ad62
commit 1e626f5
Showing
3 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
...s/framework/src/main/java/org/apache/hadoop/hdds/utils/db/DeleteFirstCompactStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
} |
12 changes: 12 additions & 0 deletions
12
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBCompactStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.apache.hadoop.hdds.utils.db; | ||
|
||
public interface RDBCompactStrategy { | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
} |
12 changes: 12 additions & 0 deletions
12
...dds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/SmallFileCompactStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.apache.hadoop.hdds.utils.db; | ||
|
||
public class SmallFileCompactStrategy implements RDBCompactStrategy { | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
} |