Skip to content

Commit a6e91ec

Browse files
authored
fix: fetch data fail due to different endpoint in SessionDataSet (#28) (#30)
* fix: fetch data fail due to different endpoint in SessionDataSet; update Docker configuration and .NET version; enhance command-line options * fix typo * remove some comments
1 parent 824d312 commit a6e91ec

12 files changed

+341
-92
lines changed

.github/workflows/dotnet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup .NET
2020
uses: actions/setup-dotnet@v4
2121
with:
22-
dotnet-version: '6.0.x'
22+
dotnet-version: '9.0.x'
2323
- name: Restore dependencies
2424
run: dotnet restore "src/Apache.IoTDB/Apache.IoTDB.csproj"
2525
- name: Check License Header

.github/workflows/e2e-multinode.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: E2E Tests in MultiNode IoTDB
2+
3+
on:
4+
push:
5+
branches: [ main, dev/* ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
11+
build:
12+
name: e2e test in MultiNode IoTDB
13+
runs-on: ubuntu-latest
14+
steps:
15+
16+
- name: Check out code into the CSharp module directory
17+
uses: actions/checkout@v4
18+
19+
- name: Set Docker & Run Test
20+
run: |
21+
docker compose -f docker-compose-2c2d.yml up --build --abort-on-container-exit --remove-orphans
22+
23+
- name: Clean IoTDB & Shut Down Docker
24+
run: |
25+
docker compose -f docker-compose-2c2d.yml down

docker-compose-2c2d.yml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
version: "3"
2+
services:
3+
4+
# ConfigNode 1
5+
confignode-1:
6+
image: apache/iotdb:2.0.1-beta-standalone
7+
command: ["bash", "-c", "entrypoint.sh confignode"]
8+
restart: always
9+
healthcheck:
10+
test: ["CMD", "ls", "/iotdb/data"]
11+
interval: 3s
12+
timeout: 5s
13+
retries: 30
14+
start_period: 30s
15+
environment:
16+
- cn_internal_address=127.0.0.1
17+
- cn_internal_port=10710
18+
- cn_consensus_port=10720
19+
- cn_seed_config_node=127.0.0.1:10710
20+
- schema_replication_factor=2
21+
- data_replication_factor=2
22+
privileged: true
23+
volumes:
24+
- ./iotdb/confignode-1/data:/iotdb/data
25+
- ./iotdb/confignode-1/logs:/iotdb/logs
26+
network_mode: host
27+
28+
# ConfigNode 2
29+
confignode-2:
30+
image: apache/iotdb:2.0.1-beta-standalone
31+
command: ["bash", "-c", "entrypoint.sh confignode"]
32+
restart: always
33+
healthcheck:
34+
test: ["CMD", "ls", "/iotdb/data"]
35+
interval: 3s
36+
timeout: 5s
37+
retries: 30
38+
start_period: 30s
39+
environment:
40+
- cn_internal_address=127.0.0.1
41+
- cn_internal_port=10711
42+
- cn_consensus_port=10721
43+
- cn_seed_config_node=127.0.0.1:10710
44+
- schema_replication_factor=2
45+
- data_replication_factor=2
46+
privileged: true
47+
volumes:
48+
- ./iotdb/confignode-2/data:/iotdb/data
49+
- ./iotdb/confignode-2/logs:/iotdb/logs
50+
network_mode: host
51+
52+
# DataNode 1
53+
datanode-1:
54+
image: apache/iotdb:2.0.1-beta-standalone
55+
command: ["bash", "-c", "entrypoint.sh datanode"]
56+
restart: always
57+
healthcheck:
58+
test: ["CMD", "ls", "/iotdb/data/datanode/system"]
59+
interval: 10s
60+
timeout: 60s
61+
retries: 30
62+
start_period: 30s
63+
depends_on:
64+
confignode-1:
65+
condition: service_healthy
66+
environment:
67+
- dn_rpc_address=127.0.0.1
68+
- dn_internal_address=127.0.0.1
69+
- dn_seed_config_node=127.0.0.1:10710
70+
- dn_rpc_port=6667
71+
- dn_internal_port=10730
72+
- dn_mpp_data_exchange_port=10740
73+
- dn_schema_region_consensus_port=10750
74+
- dn_data_region_consensus_port=10760
75+
- schema_replication_factor=2
76+
- data_replication_factor=2
77+
privileged: true
78+
volumes:
79+
- ./iotdb/datanode-1/data:/iotdb/data
80+
- ./iotdb/datanode-1/logs:/iotdb/logs
81+
network_mode: host
82+
83+
# DataNode 2
84+
datanode-2:
85+
image: apache/iotdb:2.0.1-beta-standalone
86+
command: ["bash", "-c", "entrypoint.sh datanode"]
87+
restart: always
88+
healthcheck:
89+
test: ["CMD", "ls", "/iotdb/data/datanode/system"]
90+
interval: 10s
91+
timeout: 60s
92+
retries: 30
93+
start_period: 30s
94+
depends_on:
95+
confignode-1:
96+
condition: service_healthy
97+
confignode-2:
98+
condition: service_healthy
99+
environment:
100+
- dn_rpc_address=127.0.0.1
101+
- dn_internal_address=127.0.0.1
102+
- dn_seed_config_node=127.0.0.1:10710
103+
- dn_rpc_port=6668
104+
- dn_internal_port=10731
105+
- dn_mpp_data_exchange_port=10741
106+
- dn_schema_region_consensus_port=10751
107+
- dn_data_region_consensus_port=10761
108+
- schema_replication_factor=2
109+
- data_replication_factor=2
110+
privileged: true
111+
volumes:
112+
- ./iotdb/datanode-2/data:/iotdb/data
113+
- ./iotdb/datanode-2/logs:/iotdb/logs
114+
network_mode: host
115+
116+
# C# Client
117+
apache.iotdb.samples:
118+
image: ${DOCKER_REGISTRY-}apacheiotdbsamples
119+
depends_on:
120+
confignode-1:
121+
condition: service_healthy
122+
confignode-2:
123+
condition: service_healthy
124+
datanode-1:
125+
condition: service_healthy
126+
datanode-2:
127+
condition: service_healthy
128+
build:
129+
context: .
130+
dockerfile: samples/Apache.IoTDB.Samples/Dockerfile
131+
command: ["--multi", "localhost:6667", "localhost:6668"]
132+
# command: ["sleep", "infinity"]
133+
network_mode: host

docker-compose.dcproj

Lines changed: 0 additions & 15 deletions
This file was deleted.

docker-compose.override.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ services:
1111
build:
1212
context: .
1313
dockerfile: samples/Apache.IoTDB.Samples/Dockerfile
14+
command: ["--single", "iotdb"]
1415
networks:
1516
iotdb-network:
1617
ipv4_address: 172.18.0.2

samples/Apache.IoTDB.Samples/Apache.IoTDB.Samples.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net9.0</TargetFramework>
66
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
77
<DockerfileContext>..\..</DockerfileContext>
88
</PropertyGroup>
@@ -19,6 +19,7 @@
1919
<PackageReference Include="ConsoleTableExt" Version="3.2.0" />
2020
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.15.1" />
2121
<PackageReference Include="NLog.Extensions.Logging" Version="5.0.1" />
22+
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
2223
</ItemGroup>
2324

2425
<ItemGroup>

samples/Apache.IoTDB.Samples/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717

1818
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
1919

20-
FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base
20+
FROM mcr.microsoft.com/dotnet/runtime:9.0 AS base
2121
WORKDIR /app
2222

23-
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
23+
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
2424
WORKDIR /src
2525
COPY ["samples/Apache.IoTDB.Samples/Apache.IoTDB.Samples.csproj", "samples/Apache.IoTDB.Samples/"]
2626
COPY ["src/Apache.IoTDB/Apache.IoTDB.csproj", "src/Apache.IoTDB/"]

samples/Apache.IoTDB.Samples/Program.cs

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,62 @@
1919

2020
using Microsoft.Extensions.Logging;
2121
using NLog.Extensions.Logging;
22-
using System;
2322
using System.Threading.Tasks;
23+
using System.CommandLine;
24+
using System.Collections.Generic;
25+
using System;
2426

2527
namespace Apache.IoTDB.Samples
2628
{
2729
public static class Program
2830
{
2931
public static async Task Main(string[] args)
32+
{
33+
var singleOption = new Option<string>(
34+
"--single",
35+
() => "localhost",
36+
description: "Use single endpoint (e.g. --single localhost)");
37+
38+
var multiOption = new Option<List<string>>(
39+
"--multi",
40+
description: "Use multiple endpoints (e.g. --multi localhost:6667 localhost:6668)")
41+
{
42+
AllowMultipleArgumentsPerToken = true
43+
};
44+
45+
var rootCommand = new RootCommand
46+
{
47+
singleOption,
48+
multiOption
49+
};
50+
51+
rootCommand.SetHandler(async (string single, List<string> multi) =>
3052
{
3153
var utilsTest = new UtilsTest();
3254
utilsTest.TestParseEndPoint();
33-
var sessionPoolTest = new SessionPoolTest("iotdb");
55+
56+
SessionPoolTest sessionPoolTest;
57+
58+
if (!string.IsNullOrEmpty(single) && (multi == null || multi.Count == 0))
59+
{
60+
sessionPoolTest = new SessionPoolTest(single);
61+
}
62+
else if (multi != null && multi.Count != 0)
63+
{
64+
sessionPoolTest = new SessionPoolTest(multi);
65+
}
66+
else
67+
{
68+
Console.WriteLine("Please specify either --single or --multi endpoints.");
69+
return;
70+
}
71+
3472
await sessionPoolTest.Test();
73+
74+
75+
}, singleOption, multiOption);
76+
77+
await rootCommand.InvokeAsync(args);
3578
}
3679

3780
public static void OpenDebugMode(this SessionPool session)

0 commit comments

Comments
 (0)