未验证 提交 a7cfb1ef 编写于 作者: H Haonan 提交者: GitHub

Merge pull request #1679 from apache/real_fix_wal

restore scheduleWithFixedDelay in wal manager to accelerate insertion
......@@ -53,7 +53,7 @@ flush_wal_threshold=10000
# The cycle when insert ahead log is periodically forced to be written to disk(in milliseconds)
# If force_wal_period_in_ms = 0 it means force insert ahead log to be written to disk after each refreshment
# Set this parameter to 0 may slow down the ingestion on slow disk.
force_wal_period_in_ms=10
force_wal_period_in_ms=100
####################
### Directory Configuration
......
......@@ -159,7 +159,7 @@ public class IoTDBConfig {
* The cycle when write ahead log is periodically forced to be written to disk(in milliseconds) If
* set this parameter to 0 it means call outputStream.force(true) after every each insert
*/
private long forceWalPeriodInMs = 10;
private long forceWalPeriodInMs = 100;
/**
* Size of log buffer in each log node(in byte). If WAL is enabled and the size of a insert plan
......
......@@ -46,23 +46,23 @@ public class MultiFileLogNodeManager implements WriteLogNodeManager, IService {
private ScheduledExecutorService executorService;
private IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig();
private final void forceTask(){
if (IoTDBDescriptor.getInstance().getConfig().isReadOnly()) {
logger.warn("system mode is read-only, the force flush WAL task is stopped");
return;
}
if (Thread.interrupted()) {
logger.info("WAL force thread exits.");
return;
}
for (WriteLogNode node : nodeMap.values()) {
try {
node.forceSync();
} catch (IOException e) {
logger.error("Cannot force {}, because ", node, e);
}
}
private final void forceTask() {
if (IoTDBDescriptor.getInstance().getConfig().isReadOnly()) {
logger.warn("system mode is read-only, the force flush WAL task is stopped");
return;
}
if (Thread.interrupted()) {
logger.info("WAL force thread exits.");
return;
}
for (WriteLogNode node : nodeMap.values()) {
try {
node.forceSync();
} catch (IOException e) {
logger.error("Cannot force {}, because ", node, e);
}
}
}
private MultiFileLogNodeManager() {
......@@ -117,7 +117,7 @@ public class MultiFileLogNodeManager implements WriteLogNodeManager, IService {
}
if (config.getForceWalPeriodInMs() > 0) {
executorService = Executors.newSingleThreadScheduledExecutor();
executorService.scheduleAtFixedRate(this::forceTask, config.getForceWalPeriodInMs(),
executorService.scheduleWithFixedDelay(this::forceTask, config.getForceWalPeriodInMs(),
config.getForceWalPeriodInMs(), TimeUnit.MILLISECONDS);
}
} catch (Exception e) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册