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-10504. Remove unused VolumeInfo#configuredCapacity #6363

Merged
merged 2 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@ public final class VolumeInfo {
// Space usage calculator
private final VolumeUsage usage;

// Capacity configured. This is useful when we want to
// limit the visible capacity for tests. If negative, then we just
// query from the filesystem.
private long configuredCapacity;

private long reservedInBytes;

/**
Expand All @@ -115,7 +110,6 @@ public static class Builder {
private final String rootDir;
private SpaceUsageCheckFactory usageCheckFactory;
private StorageType storageType;
private long configuredCapacity;

public Builder(String root, ConfigurationSource config) {
this.rootDir = root;
Expand All @@ -127,11 +121,6 @@ public Builder storageType(StorageType st) {
return this;
}

public Builder configuredCapacity(long capacity) {
this.configuredCapacity = capacity;
return this;
}

public Builder usageCheckFactory(SpaceUsageCheckFactory factory) {
this.usageCheckFactory = factory;
return this;
Expand Down Expand Up @@ -206,9 +195,6 @@ private VolumeInfo(Builder b) throws IOException {
this.storageType = (b.storageType != null ?
b.storageType : StorageType.DEFAULT);

this.configuredCapacity = (b.configuredCapacity != 0 ?
b.configuredCapacity : -1);

SpaceUsageCheckFactory usageCheckFactory = b.usageCheckFactory;
if (usageCheckFactory == null) {
usageCheckFactory = SpaceUsageCheckFactory.create(b.conf);
Expand All @@ -222,10 +208,7 @@ private VolumeInfo(Builder b) throws IOException {
}

public long getCapacity() {
if (configuredCapacity < 0) {
return Math.max(usage.getCapacity() - reservedInBytes, 0);
}
return configuredCapacity;
return Math.max(usage.getCapacity() - reservedInBytes, 0);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* Class that wraps the space df of the Datanode Volumes used by SCM
* containers.
*/
public class VolumeUsage implements SpaceUsageSource {
public class VolumeUsage {

private final CachingSpaceUsageSource source;
private boolean shutdownComplete;
Expand All @@ -47,7 +47,6 @@ public class VolumeUsage implements SpaceUsageSource {
start(); // TODO should start only on demand
}

@Override
public long getCapacity() {
return Math.max(source.getCapacity(), 0);
}
Expand All @@ -60,7 +59,6 @@ public long getCapacity() {
* remainingReserved
* B) avail = fsAvail - Max(reserved - other, 0);
*/
@Override
public long getAvailable() {
return source.getAvailable() - getRemainingReserved();
}
Expand All @@ -70,12 +68,10 @@ public long getAvailable(SpaceUsageSource precomputedVolumeSpace) {
return available - getRemainingReserved(precomputedVolumeSpace);
}

@Override
public long getUsedSpace() {
return source.getUsedSpace();
}

@Override
public SpaceUsageSource snapshot() {
return source.snapshot();
}
Expand Down