apache / apache/iotdb

[Bug] IoTDB v1.3.0 版本不定时出现重启之后,结构和数据均查询不到的情况

Open
#11,952 6 comments 3 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
6.4k
Forks
1.2k
Avg merge
1d 23h
Merged PRs (30d)
115

Description

### Search before asking

- [X] I searched in the [issues](https://github.com/apache/iotdb/issues) and found nothing similar.

### Version

v1.3.0

### Describe the bug and provide the minimal reproduce step

1. v1.3.0版本
2. 部署环境:
```
Distributor ID: Ubuntu
Description: Ubuntu 20.04.6 LTS
Release: 20.04
Codename: foca
```
3. JDK:
```
openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
```
4. 安装方式:Standalone 安装
1. 修改的配置如下:
1. common修改
```
config_node_consensus_protocol_class=org.apache.iotdb.consensus.simple.SimpleConsensus
schema_replication_factor=1
schema_region_consensus_protocol_class=org.apache.iotdb.consensus.simple.SimpleConsensus
data_replication_factor=1
data_region_consensus_protocol_class=org.apache.iotdb.consensus.simple.SimpleConsensus
```
2. confignode修改:
```
cn_internal_address=10.166.50.30
cn_seed_config_node=10.166.50.30:10710
```
3. datanode 修改:
```
dn_internal_address=10.166.50.30
dn_seed_config_node=10.166.50.30:10710
```
5. 启动方式
1. 先启动 confignode
```
[Unit]
Description=iotdb-confignode
Documentation=https://iotdb.apache.org/
After=network.target

[Service]
StandardOutput=null
StandardError=null
LimitNOFILE=65536
Type=simple
User=root
Group=root
Environment=JAVA_HOME=/usr/local/jdk-11.0.2
ExecStart=/usr/local/apache-iotdb-1.3.0-all-bin/sbin/start-confignode.sh
ExecStop=/usr/local/apache-iotdb-1.3.0-all-bin/sbin/stop-confignode.sh
Restart=on-failure
SuccessExitStatus=143
RestartSec=5
StartLimitInterval=600s
StartLimitBurst=3
RestartPreventExitStatus=SIGKILL

[Install]
WantedBy=multi-user.target
```
2. 后启动 datanode
```
[Unit]
Description=iotdb-datanode
Documentation=https://iotdb.apache.org/
After=network.target

[Service]
StandardOutput=null
StandardError=null
LimitNOFILE=65536
Type=simple
User=root
Group=root
Environment=JAVA_HOME=/usr/local/jdk-11.0.2
ExecStart=/usr/local/apache-iotdb-1.3.0-all-bin/sbin/start-datanode.sh
ExecStop=/usr/local/apache-iotdb-1.3.0-all-bin/sbin/stop-datanode.sh
Restart=on-failure
SuccessExitStatus=143
RestartSec=5
StartLimitInterval=600s
StartLimitBurst=3
RestartPreventExitStatus=SIGKILL

[Install]
WantedBy=multi-user.target
```
6. 写入数据方式:
1. 通过JDBC写入
```java
public class JDBCExample2 {
private static Logger logger = LoggerFactory.getLogger(JDBCExample.class);
public static String GetPVPath() {
Random random = new Random();
int sId = random.nextInt(6) + 1;
int sysId = random.nextInt(1000) + 1;
StringBuilder pvIdBuilder = new StringBuilder();
String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for (int i = 0; i < 10; i++) {
int index = random.nextInt(characters.length());
char ch = characters.charAt(index);
pvIdBuilder.append(ch);
}
String pvId = pvIdBuilder.toString();

String result = String.format("root.fz4.pv.s_%d.sys_%d.pv_%s", sId, sysId, pvId);
String pvInsert =
"insert into "+result+"(timestamp, is_alarm, is_bad, pv_name, subsystem_id, equipment_name, pv_type, io_type, server_time, pv_time, " +
"original, string_value, int_value, double_value, boolean_value, dword_value, long_value, float_value, char_value, word_value, station_id) " +
"aligned VALUES(NOW(),False,False,'ceshi',110,'ceshi',9,1,1,1,'0.3','',null,null,null,null,null,1.1,'ceshi',null,1)";
System.out.println(pvInsert);
return pvInsert;
}
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Class.forName("org.apache.iotdb.jdbc.IoTDBDriver");
try{
while (true){
Connection connection =
DriverManager.getConnection(
"jdbc:iotdb://10.166.50.30:6667?version=V_1_0", "root", "root");
Statement statement = connection.createStatement();
String sql = GetPVPath();
for (int i = 1; i <= 100; i++) {
statement.addBatch(sql);
}
statement.executeBatch();
statement.clearBatch();
statement.close();
connection.close();
}
} catch (IoTDBSQLException e) {
logger.error("IoTDB Jdbc example error", e);
}
}

}

```

```
6. 写入结果:均正常写入,并可以在线查询到结果
7. 重启方式:`../sbin/stop-standalone`方式和`systemctl stop iotdb-confignode` 、`systemctl stop iotdb-datanode`
8. 重启后,查询timeseries和数据,均查询不到。
9. 再次写入:
1. 通过shell端写入sql
```sql
CREATE DATABASE root.sg1;
CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY;
CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY;
CREATE TIMESERIES root.sg1.d1.s3 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY;
insert into root.sg1.d1(timestamp, s1, s2, s3) values(now(),1,2,3);
```
2. 通过JDBC写入(和上面JDBC写入方式一样)
10. 重启
11. 重启后,查询timeseries和数据,均可以正常查询到

### What did you expect to see?

expect :
JDBC写入重启可以正常查询到数据

### What did you see instead?

怀疑JDBC写入有问题

### Anything else?

1

### Are you willing to submit a PR?

- [ ] I'm willing to submit a PR!

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue on IoTDB v1.3.0 with the supplied JDBC batch writer, then restart using the listed standalone or systemd commands. Compare the JDBC-created paths with the shell-created root.sg1 data after restart, and inspect the relevant startup and persistence behavior. Done means both schemas and data remain queryable after restart, with the JDBC-specific trigger identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
18/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.