jt2594838 commented on code in PR #19242:
URL: https://github.com/apache/iotdb/pull/19242#discussion_r4549583884
##########
integration-test/src/test/java/org/apache/iotdb/relational/it/mqtt/IoTDBMQTTServiceIT.java:
##########
@@ -33,74 +34,86 @@
import org.fusesource.mqtt.client.MQTT;
import org.fusesource.mqtt.client.QoS;
import org.junit.After;
+import org.junit.AfterClass;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
-import java.io.IOException;
import java.util.List;
+import java.util.UUID;
import java.util.concurrent.TimeUnit;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
@RunWith(IoTDBTestRunner.class)
@Category({TableLocalStandaloneIT.class, TableClusterIT.class})
public class IoTDBMQTTServiceIT {
private BlockingConnection connection;
- private static final String IP = System.getProperty("RemoteIp", "127.0.0.1");
- private static final String USER = System.getProperty("RemoteUser", "root");
- private static final String PASSWORD = System.getProperty("RemotePassword",
"root");
- private static final String DATABASE = "mqtttest";
+ private static final String USER = System.getProperty("RemoteUser",
SessionConfig.DEFAULT_USER);
+ private static final String PASSWORD =
+ System.getProperty("RemotePassword", SessionConfig.DEFAULT_PASSWORD);
public static final String FORMATTER = "line";
- @Before
- public void setUp() throws Exception {
+ @BeforeClass
+ public static void setUpClass() {
+ // Both cases use the same MQTT configuration; separate databases and
client IDs isolate them.
BaseEnv baseEnv = EnvFactory.getEnv();
baseEnv.getConfig().getDataNodeConfig().setEnableMQTTService(true);
baseEnv.getConfig().getDataNodeConfig().setMqttPayloadFormatter(FORMATTER);
+ // Serialize CONNECT and PUBLISH callbacks so the session is registered
before each
+ // payload's single publish is processed.
+ baseEnv.getConfig().getDataNodeConfig().setMqttHandlerPoolSize(1);
Review Comment:
Apply the same CONNECT-before-PUBLISH setup to both table payload scenarios,
which also publish each input once. One broker callback worker establishes
their required session lifecycle order while preserving the existing isolated
databases and payload assertions. Both complete cases pass under TableSimpleIT
and TableClusterIT.
<!-- it-runtime-rationale:8bb2a1f92fc7d326:1086 -->
##########
integration-test/src/main/java/org/apache/iotdb/it/env/remote/config/RemoteDataNodeConfig.java:
##########
@@ -91,6 +91,11 @@ public DataNodeConfig setMqttPayloadFormatter(String
mqttPayloadFormatter) {
return this;
}
+ @Override
+ public DataNodeConfig setMqttHandlerPoolSize(int mqttHandlerPoolSize) {
Review Comment:
Keep the new IT setting a no-op for externally managed nodes, matching the
existing MQTT configuration methods: this adapter does not rewrite or restart a
remote deployment. Both configuration implementations compile through the four
targeted reactor verifications.
<!-- it-runtime-rationale:8bb2a1f92fc7d326:1084 -->
##########
integration-test/src/main/java/org/apache/iotdb/it/env/cluster/config/MppDataNodeConfig.java:
##########
@@ -139,6 +139,12 @@ public DataNodeConfig setMqttPayloadFormatter(String
mqttPayloadFormatter) {
return this;
}
+ @Override
+ public DataNodeConfig setMqttHandlerPoolSize(int mqttHandlerPoolSize) {
Review Comment:
Persist mqtt_handler_pool_size in each launched DataNode configuration. One
callback worker makes CONNECT registration complete before the queued
single-publish fixture input runs. The four full-class/profile runs pass 18
cases, and all eight DataNode logs show mqttHandlerPoolSize=1.
<!-- it-runtime-rationale:8bb2a1f92fc7d326:1083 -->
##########
integration-test/src/test/java/org/apache/iotdb/db/it/mqtt/IoTDBMQTTServiceJsonIT.java:
##########
@@ -76,9 +73,10 @@ public static void beforeClass() throws Exception {
BaseEnv baseEnv = EnvFactory.getEnv();
baseEnv.getConfig().getDataNodeConfig().setEnableMQTTService(true);
baseEnv.getConfig().getDataNodeConfig().setMqttPayloadFormatter(FORMATTER);
+ // Serialize CONNECT and PUBLISH callbacks so the session is registered
before each
+ // payload's single publish is processed.
+ baseEnv.getConfig().getDataNodeConfig().setMqttHandlerPoolSize(1);
Review Comment:
Serialize broker CONNECT and PUBLISH callbacks for the JSON payload
scenarios. With two callback workers a first PUBLISH can run before the session
map is populated and be discarded, which is consistent with the Windows test
timeout. A controlled probe of the actual Moquette executor reproduces callback
overtaking with two workers and ordered execution with one; the complete
seven-case class passes on both one and three DataNodes. The existing single
publish, illegal-measurement input and data assertions are retained.
<!-- it-runtime-rationale:8bb2a1f92fc7d326:1085 -->
##########
integration-test/src/main/java/org/apache/iotdb/itbase/env/DataNodeConfig.java:
##########
@@ -52,6 +52,8 @@ DataNodeConfig setLoadActiveListeningCheckIntervalSeconds(
DataNodeConfig setMqttPayloadFormatter(String mqttPayloadFormatter);
+ DataNodeConfig setMqttHandlerPoolSize(int mqttHandlerPoolSize);
Review Comment:
Expose the MQTT callback pool size through the IT configuration interface so
payload fixtures can request serialized CONNECT/PUBLISH handling without
downcasting the environment. The setting is opt-in; the product default is
unchanged.
<!-- it-runtime-rationale:8bb2a1f92fc7d326:1082 -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]