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 @@ -34,7 +34,7 @@
import static org.junit.Assert.fail;

@RunWith(IoTDBTestRunner.class)
public abstract class AbstractScript {
public abstract class AbstractScriptIT {

protected void testOutput(ProcessBuilder builder, @Nullable String[] output, int statusCode)
throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

@RunWith(IoTDBTestRunner.class)
@Category({LocalStandaloneIT.class, ClusterIT.class})
public class StartClientScriptIT extends AbstractScript {
public class StartClientScriptIT extends AbstractScriptIT {

private static String ip;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@

@RunWith(IoTDBTestRunner.class)
@Category({ClusterIT.class})
public class IoTDBAutoRegionGroupExtensionIT2 {
public class IoTDBAutoRegionGroupExtension2IT {

private static final Logger LOGGER =
LoggerFactory.getLogger(IoTDBAutoRegionGroupExtensionIT2.class);
LoggerFactory.getLogger(IoTDBAutoRegionGroupExtension2IT.class);

private static final String testDataRegionGroupExtensionPolicy = "AUTO";
private static final String testConsensusProtocolClass = ConsensusFactory.IOT_CONSENSUS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

@RunWith(IoTDBTestRunner.class)
@Category({ClusterIT.class})
public class IoTDBPartitionTableAutoCleanTest {
public class IoTDBPartitionTableAutoCleanIT {

private static final int TEST_REPLICATION_FACTOR = 1;
private static final long TEST_TIME_PARTITION_INTERVAL = 604800000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.iotdb.it.framework.IoTDBTestRunner;
import org.apache.iotdb.itbase.category.ClusterIT;

import org.awaitility.Awaitility;
import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;
Expand All @@ -39,6 +40,7 @@
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;

import static org.apache.iotdb.util.MagicUtils.makeItCloseQuietly;
Expand Down Expand Up @@ -119,7 +121,14 @@ private void regionGroupExpand(
int selectedRegion,
int targetDataNode)
throws Exception {
statement.execute(String.format(EXPAND_FORMAT, selectedRegion, targetDataNode));
Awaitility.await()
.atMost(10, TimeUnit.SECONDS)
.pollInterval(1, TimeUnit.SECONDS)
.until(
() -> {
statement.execute(String.format(EXPAND_FORMAT, selectedRegion, targetDataNode));
return true;
});

Predicate<TShowRegionResp> expandRegionPredicate =
tShowRegionResp -> {
Expand All @@ -140,7 +149,14 @@ private void regionGroupShrink(
int selectedRegion,
int targetDataNode)
throws Exception {
statement.execute(String.format(SHRINK_FORMAT, selectedRegion, targetDataNode));
Awaitility.await()
.atMost(10, TimeUnit.SECONDS)
.pollInterval(1, TimeUnit.SECONDS)
.until(
() -> {
statement.execute(String.format(SHRINK_FORMAT, selectedRegion, targetDataNode));
return true;
});

Predicate<TShowRegionResp> shrinkRegionPredicate =
tShowRegionResp -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package org.apache.iotdb.tools.it;

import org.apache.iotdb.cli.it.AbstractScript;
import org.apache.iotdb.cli.it.AbstractScriptIT;
import org.apache.iotdb.isession.ISession;
import org.apache.iotdb.it.env.EnvFactory;
import org.apache.iotdb.it.framework.IoTDBTestRunner;
Expand All @@ -40,7 +40,7 @@

@RunWith(IoTDBTestRunner.class)
@Category({LocalStandaloneIT.class, ClusterIT.class})
public class ExportDataTestIT extends AbstractScript {
public class ExportDataTestIT extends AbstractScriptIT {
private static String ip;

private static String port;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package org.apache.iotdb.tools.it;

import org.apache.iotdb.cli.it.AbstractScript;
import org.apache.iotdb.cli.it.AbstractScriptIT;
import org.apache.iotdb.isession.ISession;
import org.apache.iotdb.it.env.EnvFactory;
import org.apache.iotdb.it.framework.IoTDBTestRunner;
Expand All @@ -41,7 +41,7 @@

@RunWith(IoTDBTestRunner.class)
@Category({LocalStandaloneIT.class, ClusterIT.class})
public class ExportSchemaTestIT extends AbstractScript {
public class ExportSchemaTestIT extends AbstractScriptIT {
private static String ip;

private static String port;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

package org.apache.iotdb.tools.it;

import org.apache.iotdb.cli.it.AbstractScript;
import org.apache.iotdb.cli.it.AbstractScriptIT;
import org.apache.iotdb.isession.ISession;
import org.apache.iotdb.it.env.EnvFactory;
import org.apache.iotdb.it.framework.IoTDBTestRunner;
Expand All @@ -41,7 +41,7 @@

@RunWith(IoTDBTestRunner.class)
@Category({LocalStandaloneIT.class, ClusterIT.class})
public class ExportTsFileTestIT extends AbstractScript {
public class ExportTsFileTestIT extends AbstractScriptIT {
private static String ip;

private static String port;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

package org.apache.iotdb.tools.it;

import org.apache.iotdb.cli.it.AbstractScript;
import org.apache.iotdb.cli.it.AbstractScriptIT;
import org.apache.iotdb.it.env.EnvFactory;
import org.apache.iotdb.it.framework.IoTDBTestRunner;
import org.apache.iotdb.itbase.category.ClusterIT;
Expand All @@ -36,7 +36,7 @@

@RunWith(IoTDBTestRunner.class)
@Category({LocalStandaloneIT.class, ClusterIT.class})
public class ImportDataTestIT extends AbstractScript {
public class ImportDataTestIT extends AbstractScriptIT {

private static String ip;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

package org.apache.iotdb.tools.it;

import org.apache.iotdb.cli.it.AbstractScript;
import org.apache.iotdb.cli.it.AbstractScriptIT;
import org.apache.iotdb.it.env.EnvFactory;
import org.apache.iotdb.it.framework.IoTDBTestRunner;
import org.apache.iotdb.itbase.category.ClusterIT;
Expand All @@ -36,7 +36,7 @@

@RunWith(IoTDBTestRunner.class)
@Category({LocalStandaloneIT.class, ClusterIT.class})
public class ImportSchemaTestIT extends AbstractScript {
public class ImportSchemaTestIT extends AbstractScriptIT {

private static String ip;

Expand Down
2 changes: 1 addition & 1 deletion integration-test/src/test/resources/logback-test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<logger name="org.apache.iotdb.db.integration.IoTDBCompactionIT" level="INFO"/>
<logger name="org.apache.iotdb.commons.service.RegisterManager" level="INFO"/>
<logger name="org.apache.iotdb.db.service.DataNode" level="WARN"/>
<logger name="org.apache.iotdb.db.service.RPCService" level="INFO"/>
<logger name="org.apache.iotdb.db.service.ExternalRPCService" level="INFO"/>
<logger name="org.apache.iotdb.db.service.MQTTService" level="INFO"/>
<logger name="org.apache.iotdb.db.conf.IoTDBDescriptor" level="WARN"/>
<logger name="org.apache.tsfile.common.conf.TSFileDescriptor" level="WARN"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.apache.iotdb.commons.service.ThriftService;
import org.apache.iotdb.db.protocol.rest.PingApiService;
import org.apache.iotdb.db.protocol.rest.model.ExecutionStatus;
import org.apache.iotdb.db.service.RPCService;
import org.apache.iotdb.db.service.ExternalRPCService;
import org.apache.iotdb.rpc.TSStatusCode;

import javax.ws.rs.core.Response;
Expand All @@ -32,7 +32,7 @@ public class PingApiServiceImpl extends PingApiService {

@Override
public Response tryPing(SecurityContext securityContext) {
if (RPCService.getInstance().getRPCServiceStatus().equals(ThriftService.STATUS_DOWN)) {
if (ExternalRPCService.getInstance().getRPCServiceStatus().equals(ThriftService.STATUS_DOWN)) {
return Response.status(Response.Status.SERVICE_UNAVAILABLE)
.entity(
new ExecutionStatus()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ private void setUpRPCService() throws StartupException {
.getConfig()
.setRpcImplClassName(ClientRPCServiceImpl.class.getName());
if (config.isEnableRpcService()) {
registerManager.register(RPCService.getInstance());
registerManager.register(ExternalRPCService.getInstance());
}
// init service protocols
initProtocols();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public DataNodeShutdownHook(TDataNodeLocation nodeLocation) {
public void run() {
logger.info("DataNode exiting...");
// Stop external rpc service firstly.
RPCService.getInstance().stop();
ExternalRPCService.getInstance().stop();

// Reject write operations to make sure all tsfiles will be sealed
CommonDescriptor.getInstance().getConfig().setStopping(true);
Expand Down Expand Up @@ -85,26 +85,24 @@ public void run() {
triggerSnapshotForAllDataRegion();
}

// Actually stop all services started by the DataNode.
// If we don't call this, services like the RestService are not stopped and I can't re-start
// it.
DataNode.getInstance().stop();

// Set and report shutdown to cluster ConfigNode-leader
if (!reportShutdownToConfigNodeLeader()) {
logger.warn(
"Failed to report DataNode's shutdown to ConfigNode. The cluster will still take the current DataNode as Running for a few seconds.");
}

// Actually stop all services started by the DataNode.
// If we don't call this, services like the RestService are not stopped and I can't re-start
// it.
DataNode.getInstance().stop();

// Clear lock file. All services should be shutdown before this line.
DirectoryChecker.getInstance().deregisterAll();

if (logger.isInfoEnabled()) {
logger.info(
"DataNode exits. Jvm memory usage: {}",
MemUtils.bytesCntToStr(
Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));
}
logger.info(
"DataNode exits. Jvm memory usage: {}",
MemUtils.bytesCntToStr(
Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));
}

private void triggerSnapshotForAllDataRegion() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
import java.lang.reflect.InvocationTargetException;

/** A service to handle RPC request from client. */
public class RPCService extends ThriftService implements RPCServiceMBean {
public class ExternalRPCService extends ThriftService implements RPCServiceMBean {

private IClientRPCServiceWithHandler impl;

public static RPCService getInstance() {
public static ExternalRPCService getInstance() {
return RPCServiceHolder.INSTANCE;
}

Expand Down Expand Up @@ -122,7 +122,7 @@ public int getRPCPort() {

private static class RPCServiceHolder {

private static final RPCService INSTANCE = new RPCService();
private static final ExternalRPCService INSTANCE = new ExternalRPCService();

private RPCServiceHolder() {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package org.apache.iotdb.db.protocol.rest;

import org.apache.iotdb.commons.exception.StartupException;
import org.apache.iotdb.db.service.RPCService;
import org.apache.iotdb.db.service.ExternalRPCService;
import org.apache.iotdb.db.utils.EnvironmentUtils;

import com.fasterxml.jackson.databind.ObjectMapper;
Expand Down Expand Up @@ -86,14 +86,14 @@ public void ping() {
assertEquals(200, Integer.parseInt(result.get("code").toString()));

// Shutdown RPCService to test
RPCService.getInstance().stop();
ExternalRPCService.getInstance().stop();
response = httpClient.execute(httpGet);
responseEntity = response.getEntity();
message = EntityUtils.toString(responseEntity, "utf-8");
result = JsonParser.parseString(message).getAsJsonObject();
assertEquals(503, response.getStatusLine().getStatusCode());
assertEquals(500, Integer.parseInt(result.get("code").toString()));
RPCService.getInstance().start();
ExternalRPCService.getInstance().start();

} catch (IOException | StartupException e) {
e.printStackTrace();
Expand Down
2 changes: 1 addition & 1 deletion iotdb-core/datanode/src/test/resources/logback-test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<logger name="org.apache.iotdb.db.queryengine.common.schematree" level="INFO"/>
<logger name="org.apache.iotdb.commons.service.RegisterManager" level="INFO"/>
<logger name="org.apache.iotdb.db.service.DataNode" level="WARN"/>
<logger name="org.apache.iotdb.db.service.RPCService" level="INFO"/>
<logger name="org.apache.iotdb.db.service.ExternalRPCService" level="INFO"/>
<logger name="org.apache.iotdb.db.service.MQTTService" level="INFO"/>
<logger name="org.apache.iotdb.db.storageengine.compaction.cross.rewrite.task" level="ERROR"/>
<logger name="io.moquette.broker.metrics.MQTTMessageLogger" level="ERROR"/>
Expand Down