Skip to content

Commit

Permalink
111
Browse files Browse the repository at this point in the history
  • Loading branch information
guohao-rosicky committed Nov 6, 2024
1 parent 782ad62 commit 1e626f5
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 0 deletions.
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;
}







}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.apache.hadoop.hdds.utils.db;

public interface RDBCompactStrategy {








}
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 {








}

0 comments on commit 1e626f5

Please sign in to comment.