[minor](log) change debug log to info to observe the storage medium change #19529

When user set default_storage_medium to true, the storage medium of all partitions should be SSD,
and cooldown time should be 9999-12-31 23:59:59.
So that it won't change to HDD.

But looks like sometimes it still change to HDD.
So I change the debug log to info to observer it.
This commit is contained in:
Mingyu Chen
2023-05-12 11:02:55 +08:00
committed by GitHub
parent 8ef9212ddc
commit 9bf6ecca48
3 changed files with 17 additions and 6 deletions

View File

@ -35,10 +35,12 @@ import java.io.IOException;
import java.util.Objects;
public class DataProperty implements Writable, GsonPostProcessable {
public static final TStorageMedium DEFAULT_STORAGE_MEDIUM =
"SSD".equalsIgnoreCase(Config.default_storage_medium) ? TStorageMedium.SSD : TStorageMedium.HDD;
public static final TStorageMedium DEFAULT_STORAGE_MEDIUM = "SSD".equalsIgnoreCase(Config.default_storage_medium)
? TStorageMedium.SSD : TStorageMedium.HDD;
public static final long MAX_COOLDOWN_TIME_MS = 253402271999000L; // 9999-12-31 23:59:59
public static final DataProperty DEFAULT_HDD_DATA_PROPERTY = new DataProperty(TStorageMedium.HDD);
@SerializedName(value = "storageMedium")
private TStorageMedium storageMedium;
@SerializedName(value = "cooldownTimeMs")
@ -58,6 +60,13 @@ public class DataProperty implements Writable, GsonPostProcessable {
this.storagePolicy = "";
}
public DataProperty(DataProperty other) {
this.storageMedium = other.storageMedium;
this.cooldownTimeMs = other.cooldownTimeMs;
this.storagePolicy = other.storagePolicy;
this.isMutable = other.isMutable;
}
/**
* DataProperty construction.
*

View File

@ -3447,8 +3447,10 @@ public class Env {
DataProperty hddProperty = new DataProperty(TStorageMedium.HDD);
partitionInfo.setDataProperty(partition.getId(), hddProperty);
storageMediumMap.put(partitionId, TStorageMedium.HDD);
LOG.debug("partition[{}-{}-{}] storage medium changed from SSD to HDD", dbId, tableId,
partitionId);
LOG.info("partition[{}-{}-{}] storage medium changed from SSD to HDD. "
+ "cooldown time: {}. current time: {}", dbId, tableId, partitionId,
TimeUtils.longToTimeString(dataProperty.getCooldownTimeMs()),
TimeUtils.longToTimeString(currentTimeMs));
// log
ModifyPartitionInfo info = new ModifyPartitionInfo(db.getId(), olapTable.getId(),

View File

@ -352,7 +352,7 @@ public class PartitionInfo implements Writable {
out.writeInt(idToDataProperty.size());
for (Map.Entry<Long, DataProperty> entry : idToDataProperty.entrySet()) {
out.writeLong(entry.getKey());
if (entry.getValue().equals(new DataProperty(TStorageMedium.HDD))) {
if (entry.getValue().equals(DataProperty.DEFAULT_HDD_DATA_PROPERTY)) {
out.writeBoolean(true);
} else {
out.writeBoolean(false);
@ -372,7 +372,7 @@ public class PartitionInfo implements Writable {
long partitionId = in.readLong();
boolean isDefaultHddDataProperty = in.readBoolean();
if (isDefaultHddDataProperty) {
idToDataProperty.put(partitionId, new DataProperty(TStorageMedium.HDD));
idToDataProperty.put(partitionId, new DataProperty(DataProperty.DEFAULT_HDD_DATA_PROPERTY));
} else {
idToDataProperty.put(partitionId, DataProperty.read(in));
}