You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/01/04 02:33:10 UTC
[incubator-doris] branch master updated: [Improvement] use "storage_cooldown_seconds" property when storage medium is SSD (#7532)
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push:
new 5c104ec [Improvement] use "storage_cooldown_seconds" property when storage medium is SSD (#7532)
5c104ec is described below
commit 5c104ec2d10f628e7350571b1066a5db84779144
Author: wei zhao <zh...@163.com>
AuthorDate: Tue Jan 4 10:32:57 2022 +0800
[Improvement] use "storage_cooldown_seconds" property when storage medium is SSD (#7532)
Refer to this issue #7528
When setting property `default_storage_medium=ssd` and `storage_cooldown_second=xxx` in `fe.conf`
`cooldownTime=System.currentTimeMillis()+ storage_cooldown_second` , not always `MAX_COOLDOWN_TIME_MS`
---
.../org/apache/doris/catalog/DataProperty.java | 8 ++++-
.../org/apache/doris/catalog/DataPropertyTest.java | 42 ++++++++++++++++++++++
2 files changed, 49 insertions(+), 1 deletion(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/DataProperty.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/DataProperty.java
index 593f3d3..8d4c22c 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/DataProperty.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/DataProperty.java
@@ -43,7 +43,13 @@ public class DataProperty implements Writable {
}
public DataProperty(TStorageMedium medium) {
- this(medium, MAX_COOLDOWN_TIME_MS);
+ this.storageMedium = medium;
+ if (medium == TStorageMedium.SSD) {
+ long currentTimeMs = System.currentTimeMillis();
+ this.cooldownTimeMs = currentTimeMs + Config.storage_cooldown_second * 1000L;
+ } else {
+ this.cooldownTimeMs = MAX_COOLDOWN_TIME_MS;
+ }
}
public DataProperty(TStorageMedium medium, long cooldown) {
diff --git a/fe/fe-core/src/test/java/org/apache/doris/catalog/DataPropertyTest.java b/fe/fe-core/src/test/java/org/apache/doris/catalog/DataPropertyTest.java
new file mode 100644
index 0000000..7bb4eac
--- /dev/null
+++ b/fe/fe-core/src/test/java/org/apache/doris/catalog/DataPropertyTest.java
@@ -0,0 +1,42 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.catalog;
+
+import org.apache.doris.common.Config;
+import org.apache.doris.thrift.TStorageMedium;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class DataPropertyTest {
+
+ @Test
+ public void tesCooldownTimeMs() throws Exception {
+ Config.default_storage_medium = "ssd";
+ DataProperty dataProperty = DataProperty.DEFAULT_DATA_PROPERTY;
+ Assert.assertNotEquals(DataProperty.MAX_COOLDOWN_TIME_MS, dataProperty.getCooldownTimeMs());
+
+ dataProperty = new DataProperty(TStorageMedium.SSD);
+ Assert.assertNotEquals(DataProperty.MAX_COOLDOWN_TIME_MS, dataProperty.getCooldownTimeMs());
+
+ dataProperty = new DataProperty(TStorageMedium.SSD, System.currentTimeMillis() + 24 * 3600 * 1000L);
+ Assert.assertEquals(System.currentTimeMillis() + 24 * 3600 * 1000L, dataProperty.getCooldownTimeMs());
+
+ dataProperty = new DataProperty(TStorageMedium.HDD);
+ Assert.assertEquals(DataProperty.MAX_COOLDOWN_TIME_MS, dataProperty.getCooldownTimeMs());
+ }
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org