You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ne...@apache.org on 2021/07/08 03:22:18 UTC
[iotdb] branch apache_0.12_0630_apply_stuck updated: debug apply
stuck
This is an automated email from the ASF dual-hosted git repository.
neuyilan pushed a commit to branch apache_0.12_0630_apply_stuck
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/apache_0.12_0630_apply_stuck by this push:
new 6c933c8 debug apply stuck
6c933c8 is described below
commit 6c933c80735c620804ab43745046eb2dae45b870
Author: HouliangQi <ne...@163.com>
AuthorDate: Thu Jul 8 11:21:46 2021 +0800
debug apply stuck
---
.../iotdb/cluster/log/manage/RaftLogManager.java | 29 ++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/log/manage/RaftLogManager.java b/cluster/src/main/java/org/apache/iotdb/cluster/log/manage/RaftLogManager.java
index a46bca2..7926230 100644
--- a/cluster/src/main/java/org/apache/iotdb/cluster/log/manage/RaftLogManager.java
+++ b/cluster/src/main/java/org/apache/iotdb/cluster/log/manage/RaftLogManager.java
@@ -31,6 +31,10 @@ import org.apache.iotdb.cluster.log.LogApplier;
import org.apache.iotdb.cluster.log.Snapshot;
import org.apache.iotdb.cluster.log.StableEntryManager;
import org.apache.iotdb.cluster.server.monitor.Timer.Statistic;
+import org.apache.iotdb.db.engine.StorageEngine;
+import org.apache.iotdb.db.exception.StorageEngineException;
+import org.apache.iotdb.db.exception.metadata.IllegalPathException;
+import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.utils.TestOnly;
import org.apache.iotdb.tsfile.utils.RamUsageEstimator;
@@ -46,6 +50,7 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -65,6 +70,7 @@ public abstract class RaftLogManager {
/** manage uncommitted entries */
private UnCommittedEntryManager unCommittedEntryManager;
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss"); // 可以方便地修改日期格式
/** manage committed entries in memory as a cache */
private CommittedEntryManager committedEntryManager;
@@ -951,7 +957,7 @@ public abstract class RaftLogManager {
return;
}
long startTime = System.currentTimeMillis();
- long lastDump = Long.MAX_VALUE;
+ long lastDump = 0;
synchronized (log) {
while (!log.isApplied() && maxHaveAppliedCommitIndex < log.getCurrLogIndex()) {
// wait until the log is applied or a newer snapshot is installed
@@ -965,18 +971,37 @@ public abstract class RaftLogManager {
Process proc = Runtime.getRuntime().exec(command);
BufferedReader reader =
new BufferedReader(new InputStreamReader(proc.getInputStream()));
- String fileName = System.getProperty("user.dir") + File.separator + "jstack_" + now;
+ String fileName =
+ System.getProperty("user.dir")
+ + File.separator
+ + "jstack_"
+ + dateFormat.format(now);
BufferedWriter out = new BufferedWriter(new FileWriter(fileName));
String str;
while ((str = reader.readLine()) != null) {
out.write(str);
out.newLine();
}
+ List<PartialPath> storageGroupList = new ArrayList<>();
+ for (int i = 0; i < 10; i++) {
+ storageGroupList.add(new PartialPath("root.group_" + i));
+ }
+ List<String> lockHolderList =
+ StorageEngine.getInstance().getLockInfo(storageGroupList);
+
+ for (int i = 0; i < storageGroupList.size(); i++) {
+ out.write(storageGroupList.get(i) + ", " + lockHolderList.get(i));
+ out.newLine();
+ }
out.close();
reader.close();
proc.waitFor();
} catch (IOException e) {
logger.error("dump thread failed, e", e);
+ } catch (IllegalPathException e) {
+ logger.error("qihouliang, e");
+ } catch (StorageEngineException e) {
+ logger.error("qihouliang, e");
}
lastDump = System.currentTimeMillis();
}