Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public void queryTableSessionPool() throws IoTDBConnectionException, StatementEx
}
System.out.println();
}
sessionDataSet.close();
tableSession.close();
}

public void querySessionPool() throws IoTDBConnectionException, StatementExecutionException {
Expand All @@ -65,5 +67,6 @@ public void querySessionPool() throws IoTDBConnectionException, StatementExecuti
}
System.out.println();
}
sessionDataSetWrapper.close();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

spring.application.name=iotdb-spring-boot-start

iotdb.session.url=127.0.0.1:6667
iotdb.session.node_urls=172.20.31.56:6668
iotdb.session.password=root
iotdb.session.username=root
iotdb.session.database=wind
iotdb.session.sql-dialect=table
iotdb.session.max-size=10
iotdb.session.sql_dialect=table
iotdb.session.max_size=10
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@

package org.apache.iotdb.config;

import org.apache.iotdb.isession.SessionConfig;

import org.springframework.boot.context.properties.ConfigurationProperties;

import java.time.ZoneId;

@ConfigurationProperties(prefix = "iotdb.session")
public class IoTDBSessionProperties {
private String url;
private String node_urls;
private String username;
private String password;
private String database;
Expand All @@ -30,18 +34,27 @@ public class IoTDBSessionProperties {
private Integer fetch_size = 1024;
private long query_timeout_in_ms = 60000L;
private boolean enable_auto_fetch = true;
private boolean use_ssl = false;
private int max_retry_count = 60;
private long wait_to_get_session_timeout_in_msit = 60000L;
private boolean enable_compression = false;
private long retry_interval_in_ms = 500L;
private long retry_interval_in_ms = SessionConfig.RETRY_INTERVAL_IN_MS;
private boolean use_ssl = false;
private String trust_store;
private String trust_store_pwd;
private int connection_timeout_in_ms;
private ZoneId zone_id;
private int thrift_default_buffer_size = 1024;
private int thrift_max_frame_size = 67108864;
private boolean enable_redirection;
private boolean enable_records_auto_convert_tablet =
SessionConfig.DEFAULT_RECORDS_AUTO_CONVERT_TABLET;

public String getUrl() {
return url;
public String getNode_urls() {
return node_urls;
}

public void setUrl(String url) {
this.url = url;
public void setNode_urls(String node_urls) {
this.node_urls = node_urls;
}

public String getUsername() {
Expand Down Expand Up @@ -171,4 +184,68 @@ public long getRetry_interval_in_ms() {
public void setRetry_interval_in_ms(long retry_interval_in_ms) {
this.retry_interval_in_ms = retry_interval_in_ms;
}

public String getTrust_store() {
return trust_store;
}

public void setTrust_store(String trust_store) {
this.trust_store = trust_store;
}

public String getTrust_store_pwd() {
return trust_store_pwd;
}

public void setTrust_store_pwd(String trust_store_pwd) {
this.trust_store_pwd = trust_store_pwd;
}

public int getConnection_timeout_in_ms() {
return connection_timeout_in_ms;
}

public void setConnection_timeout_in_ms(int connection_timeout_in_ms) {
this.connection_timeout_in_ms = connection_timeout_in_ms;
}

public ZoneId getZone_id() {
return zone_id;
}

public void setZone_id(ZoneId zone_id) {
this.zone_id = zone_id;
}

public int getThrift_default_buffer_size() {
return thrift_default_buffer_size;
}

public void setThrift_default_buffer_size(int thrift_default_buffer_size) {
this.thrift_default_buffer_size = thrift_default_buffer_size;
}

public int getThrift_max_frame_size() {
return thrift_max_frame_size;
}

public void setThrift_max_frame_size(int thrift_max_frame_size) {
this.thrift_max_frame_size = thrift_max_frame_size;
}

public boolean isEnable_redirection() {
return enable_redirection;
}

public void setEnable_redirection(boolean enable_redirection) {
this.enable_redirection = enable_redirection;
}

public boolean isEnable_records_auto_convert_tablet() {
return enable_records_auto_convert_tablet;
}

public void setEnable_records_auto_convert_tablet(boolean enable_records_auto_convert_tablet) {
this.enable_records_auto_convert_tablet = enable_records_auto_convert_tablet;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public ITableSessionPool tableSessionPool() {
if (tableSessionPool == null) {
tableSessionPool =
new TableSessionPoolBuilder()
.nodeUrls(Arrays.asList(properties.getUrl().split(";")))
.nodeUrls(Arrays.asList(properties.getNode_urls().split(";")))
.user(properties.getUsername())
.password(properties.getPassword())
.database(properties.getDatabase())
Expand All @@ -63,6 +63,13 @@ public ITableSessionPool tableSessionPool() {
.waitToGetSessionTimeoutInMs(properties.getQuery_timeout_in_ms())
.enableCompression(properties.isEnable_compression())
.retryIntervalInMs(properties.getRetry_interval_in_ms())
.trustStore(properties.getTrust_store())
.trustStorePwd(properties.getTrust_store_pwd())
.connectionTimeoutInMs(properties.getConnection_timeout_in_ms())
.zoneId(properties.getZone_id())
.thriftDefaultBufferSize(properties.getThrift_default_buffer_size())
.thriftMaxFrameSize(properties.getThrift_max_frame_size())
.enableRedirection(properties.isEnable_redirection())
.build();
}
}
Expand All @@ -77,7 +84,7 @@ public ISessionPool treeSessionPool() {
if (treeSessionPool == null) {
treeSessionPool =
new SessionPool.Builder()
.nodeUrls(Arrays.asList(properties.getUrl().split(";")))
.nodeUrls(Arrays.asList(properties.getNode_urls().split(";")))
.user(properties.getUsername())
.password(properties.getPassword())
.maxSize(properties.getMax_size())
Expand All @@ -89,6 +96,14 @@ public ISessionPool treeSessionPool() {
.waitToGetSessionTimeoutInMs(properties.getQuery_timeout_in_ms())
.enableCompression(properties.isEnable_compression())
.retryIntervalInMs(properties.getRetry_interval_in_ms())
.trustStore(properties.getTrust_store())
.trustStorePwd(properties.getTrust_store_pwd())
.connectionTimeoutInMs(properties.getConnection_timeout_in_ms())
.zoneId(properties.getZone_id())
.thriftDefaultBufferSize(properties.getThrift_default_buffer_size())
.thriftMaxFrameSize(properties.getThrift_max_frame_size())
.enableRedirection(properties.isEnable_redirection())
.enableRecordsAutoConvertTablet(properties.isEnable_records_auto_convert_tablet())
.build();
}
}
Expand Down