[Bug] IoTDB v1.3.0 版本不定时出现重启之后,结构和数据均查询不到的情况
- Ngôn ngữ chính
- Java
- Star
- 6.4k
- Fork
- 1.2k
- Merge trung bình
- 1 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 115
Mô tả
### 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!
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện sự cố trên IoTDB v1.3.0 với JDBC batch writer được cung cấp, sau đó khởi động lại bằng các lệnh standalone hoặc systemd được liệt kê. Sau khi khởi động lại, hãy so sánh các đường dẫn được tạo bởi JDBC với dữ liệu root.sg1 được tạo bằng shell, đồng thời kiểm tra hành vi khởi động và persistence liên quan. Công việc được xem là hoàn tất khi cả hai schema và dữ liệu vẫn có thể truy vấn sau khi khởi động lại, đồng thời đã xác định được trigger đặc thù của JDBC.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- Lĩnh vực
- databases
- Loại issue
- Lỗi
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 18/100