From 80e1b981eb484076de95a65ee40fda05c95d4e0b Mon Sep 17 00:00:00 2001 From: JackieTien97 Date: Wed, 18 Oct 2023 15:24:58 +0800 Subject: [PATCH] support nodeurls in session mode --- .../edu/tsinghua/iot/benchmark/iotdb110/IoTDBSession.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/iotdb-1.1/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb110/IoTDBSession.java b/iotdb-1.1/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb110/IoTDBSession.java index 27c1f5107..e0ee631a6 100644 --- a/iotdb-1.1/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb110/IoTDBSession.java +++ b/iotdb-1.1/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb110/IoTDBSession.java @@ -32,6 +32,7 @@ import cn.edu.tsinghua.iot.benchmark.tsdb.TsdbException; import org.slf4j.LoggerFactory; +import java.util.ArrayList; import java.util.List; import java.util.concurrent.Executors; @@ -159,11 +160,14 @@ public SessionDataSet.DataIterator iterator() { public IoTDBSession(DBConfig dbConfig) { super(dbConfig); LOGGER = LoggerFactory.getLogger(IoTDBSession.class); + List hostUrls = new ArrayList<>(dbConfig.getHOST().size()); + for (int i = 0; i < dbConfig.getHOST().size(); i++) { + hostUrls.add(dbConfig.getHOST().get(i) + ":" + dbConfig.getPORT().get(i)); + } sessionWrapper = new BenchmarkSession( new Session.Builder() - .host(dbConfig.getHOST().get(0)) - .port(Integer.parseInt(dbConfig.getPORT().get(0))) + .nodeUrls(hostUrls) .username(dbConfig.getUSERNAME()) .password(dbConfig.getPASSWORD()) .enableRedirection(true)