Skip to content
Open
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 @@ -21,6 +21,8 @@

import org.apache.iotdb.isession.SessionConfig;
import org.apache.iotdb.it.env.EnvFactory;
import org.apache.iotdb.it.env.cluster.ClusterConstant;
import org.apache.iotdb.it.env.cluster.EnvUtils;
import org.apache.iotdb.it.env.cluster.node.DataNodeWrapper;
import org.apache.iotdb.it.framework.IoTDBTestRunner;
import org.apache.iotdb.itbase.category.TableClusterIT;
Expand Down Expand Up @@ -53,6 +55,11 @@
@Category({TableLocalStandaloneIT.class, TableClusterIT.class})
public class IoTDBMultiTAGsWithAttributesTableIT {
private static final String DATABASE_NAME = "db";
// Default heap of the test DataNodes (see DataNodeWrapper#initVMConfig).
private static final int DEFAULT_DATANODE_MAX_HEAP_SIZE_IN_MB = 256;
// fourTableJoinTest needs about 3.5 MB of operator memory per DataRegion. A 256 MB heap has
// about 16 MB of it, enough for about 4 regions; 128 MB of heap per region leaves a 2x margin.
private static final int DATANODE_HEAP_SIZE_PER_DATA_REGION_IN_MB = 128;

private static final String[] sql1 =
new String[] {
Expand Down Expand Up @@ -185,6 +192,22 @@ public class IoTDBMultiTAGsWithAttributesTableIT {
@BeforeClass
public static void setUp() throws Exception {
EnvFactory.getEnv().getConfig().getDataNodeCommonConfig().setSortBufferSize(1024 * 1024L);
// The number of DataRegionGroups follows the CPU cores (0.5 per core), and with it the number
// of FragmentInstances of fourTableJoinTest, each reserving up to the 1 MB sort buffer. Scale
// the DataNode heap, and so its operator memory, with the regions. On a 4-core machine
// (2 regions) this keeps the default heap.
final int expectedDataRegionsPerDataNode =
Math.max(1, Runtime.getRuntime().availableProcessors() / 2);
EnvFactory.getEnv()
.getConfig()
.getDataNodeJVMConfig()
.setMaxHeapSize(
Math.max(
EnvUtils.getIntFromSysVar(
ClusterConstant.DATANODE_MAX_HEAP_SIZE,
DEFAULT_DATANODE_MAX_HEAP_SIZE_IN_MB,
0),
expectedDataRegionsPerDataNode * DATANODE_HEAP_SIZE_PER_DATA_REGION_IN_MB));
EnvFactory.getEnv().initClusterEnvironment();
EnvFactory.getEnv()
.getConfig()
Expand Down
Loading