Skip to content
Open
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
17 changes: 6 additions & 11 deletions src/java/org/apache/cassandra/cql3/QueryOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ static ReadThresholds create()
// if daemon initialization hasn't happened yet (very common in tests) then ignore
if (!DatabaseDescriptor.isDaemonInitialized() || !DatabaseDescriptor.getReadThresholdsEnabled())
return DisabledReadThresholds.INSTANCE;
return new DefaultReadThresholds(DatabaseDescriptor.getCoordinatorReadSizeWarnThreshold(), DatabaseDescriptor.getCoordinatorReadSizeFailThreshold());
return DefaultReadThresholds.INSTANCE;
}
}

Expand Down Expand Up @@ -351,14 +351,7 @@ public long getCoordinatorReadSizeFailThresholdBytes()

private static class DefaultReadThresholds implements ReadThresholds
{
private final long warnThresholdBytes;
private final long abortThresholdBytes;

public DefaultReadThresholds(DataStorageSpec.LongBytesBound warnThreshold, DataStorageSpec.LongBytesBound abortThreshold)
{
this.warnThresholdBytes = warnThreshold == null ? -1 : warnThreshold.toBytes();
this.abortThresholdBytes = abortThreshold == null ? -1 : abortThreshold.toBytes();
}
private static final DefaultReadThresholds INSTANCE = new DefaultReadThresholds();

@Override
public boolean isEnabled()
Expand All @@ -369,13 +362,15 @@ public boolean isEnabled()
@Override
public long getCoordinatorReadSizeWarnThresholdBytes()
{
return warnThresholdBytes;
DataStorageSpec.LongBytesBound warnThreshold = DatabaseDescriptor.getCoordinatorReadSizeWarnThreshold();
return warnThreshold == null ? -1 : warnThreshold.toBytes();
}

@Override
public long getCoordinatorReadSizeFailThresholdBytes()
{
return abortThresholdBytes;
DataStorageSpec.LongBytesBound abortThreshold = DatabaseDescriptor.getCoordinatorReadSizeFailThreshold();
return abortThreshold == null ? -1 : abortThreshold.toBytes();
}
}

Expand Down