Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDDS-8101. Add FSO repair tool to ozone CLI in read-only and repair modes. #6608

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public static List<byte[]> listColumnFamiliesEmptyOptions(final String path)
}
}

static RocksDatabase open(File dbFile, ManagedDBOptions dbOptions,
public static RocksDatabase open(File dbFile, ManagedDBOptions dbOptions,
ManagedWriteOptions writeOptions, Set<TableConfig> families,
boolean readOnly) throws IOException {
List<ColumnFamilyDescriptor> descriptors = null;
Expand Down Expand Up @@ -461,8 +461,13 @@ public void ingestExternalFile(ColumnFamily family, List<String> files,

public void put(ColumnFamily family, byte[] key, byte[] value)
throws IOException {
put(family.getHandle(), key, value);
}

public void put(ColumnFamilyHandle handle, byte[] key, byte[] value)
throws IOException {
try (UncheckedAutoCloseable ignored = acquire()) {
db.get().put(family.getHandle(), writeOptions, key, value);
db.get().put(handle, writeOptions, key, value);
} catch (RocksDBException e) {
closeOnError(e);
throw toIOException(this, "put " + bytes2String(key), e);
Expand Down Expand Up @@ -622,9 +627,14 @@ RocksCheckpoint createCheckpoint() {
*/
Supplier<byte[]> keyMayExist(ColumnFamily family, byte[] key)
throws IOException {
return keyMayExist(family.getHandle(), key);
}

public Supplier<byte[]> keyMayExist(ColumnFamilyHandle handle, byte[] key)
throws IOException {
try (UncheckedAutoCloseable ignored = acquire()) {
final Holder<byte[]> out = new Holder<>();
return db.get().keyMayExist(family.getHandle(), key, out) ?
return db.get().keyMayExist(handle, key, out) ?
out::getValue : null;
}
}
Expand Down Expand Up @@ -653,16 +663,39 @@ public Collection<ColumnFamily> getExtraColumnFamilies() {
return Collections.unmodifiableCollection(columnFamilies.values());
}

byte[] get(ColumnFamily family, byte[] key) throws IOException {
public void dropColumnFamily(ColumnFamilyHandle handle) throws IOException {
try (UncheckedAutoCloseable ignored = acquire()) {
return db.get().get(family.getHandle(), key);
db.get().dropColumnFamily(handle);
} catch (RocksDBException e) {
closeOnError(e);
final String message = "get " + bytes2String(key) + " from " + family;
throw toIOException(this, "dropColumnFamily", e);
}
}

public ColumnFamilyHandle createColumnFamily(ColumnFamilyDescriptor descriptor) throws IOException {
try (UncheckedAutoCloseable ignored = acquire()) {
return db.get().createColumnFamily(descriptor);
} catch (RocksDBException e) {
closeOnError(e);
throw toIOException(this, "createColumnFamily", e);
}
}

public byte[] get(ColumnFamily family, byte[] key) throws IOException {
return get(family.getHandle(), key, family.getName());
}

public byte[] get(ColumnFamilyHandle handle, byte[] key, String familyName) throws IOException {
try (UncheckedAutoCloseable ignored = acquire()) {
return db.get().get(handle, key);
} catch (RocksDBException e) {
closeOnError(e);
final String message = "get " + bytes2String(key) + " from " + familyName;
throw toIOException(this, message, e);
}
}


/**
* Get the value mapped to the given key.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,5 @@ public void deleteFile(LiveFileMetaData fileToBeDeleted)
File file = new File(fileToBeDeleted.path(), fileToBeDeleted.fileName());
ManagedRocksObjectUtils.waitForFileDelete(file, Duration.ofSeconds(60));
}

}