Skip to content
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 @@ -47,6 +47,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicLong;

Expand Down Expand Up @@ -111,8 +112,8 @@ public TSStatus setSpaceQuota(final TSetSpaceQuotaReq req) {
/** If the new quota is smaller than the quota already used, the setting fails. */
private boolean checkSpaceQuota(TSetSpaceQuotaReq req) {
for (String database : req.getDatabase()) {
if (quotaInfo.getSpaceQuotaLimit().containsKey(database)) {
TSpaceQuota spaceQuota = quotaInfo.getSpaceQuotaUsage().get(database);
TSpaceQuota spaceQuota = quotaInfo.getSpaceQuotaUsage().get(database);
if (Objects.nonNull(spaceQuota)) {
if (req.getSpaceLimit().getDeviceNum() != IoTDBConstant.UNLIMITED_VALUE
&& req.getSpaceLimit().getDeviceNum() != IoTDBConstant.DEFAULT_VALUE
&& spaceQuota.getDeviceNum() > req.getSpaceLimit().getDeviceNum()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ public TSStatus setSpaceQuota(SetSpaceQuotaPlan setSpaceQuotaPlan) {
spaceQuota.setDiskSize(IoTDBConstant.DEFAULT_VALUE);
}
}
if (!spaceQuotaUsage.containsKey(database)) {
spaceQuotaUsage.put(database, new TSpaceQuota());
}
spaceQuotaUsage.computeIfAbsent(database, k -> new TSpaceQuota());
spaceQuotaLimit.put(database, spaceQuota);
}
return RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS);
Expand Down
Loading