Skip to content

Commit

Permalink
Add test coverage for consuming segment using on-heap.
Browse files Browse the repository at this point in the history
With PR apache#8380, we modified the default value for
`pinot.server.instance.realtime.alloc.offheap` to use off-heap. Explicitly setting
it to use on-heap in some of the integration tests for coverage.
  • Loading branch information
mayankshriv committed Mar 22, 2022
1 parent 2d5cbf7 commit c6c8287
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.apache.pinot.spi.config.table.TableType;
import org.apache.pinot.spi.data.Schema;
import org.apache.pinot.spi.env.PinotConfiguration;
import org.apache.pinot.spi.utils.CommonConstants;
import org.apache.pinot.spi.utils.JsonUtils;
import org.apache.pinot.spi.utils.builder.TableNameBuilder;
import org.apache.pinot.util.TestUtils;
Expand Down Expand Up @@ -60,6 +61,7 @@ protected String getServerTenant() {

@Override
protected void overrideServerConf(PinotConfiguration configuration) {
configuration.setProperty(CommonConstants.Server.CONFIG_OF_REALTIME_OFFHEAP_ALLOCATION, false);
}

@BeforeClass
Expand Down Expand Up @@ -123,16 +125,13 @@ protected void startHybridCluster()
public void testSegmentMetadataApi()
throws Exception {
{
String jsonOutputStr = sendGetRequest(
_controllerRequestURLBuilder.forSegmentMetadata(getTableName()));
String jsonOutputStr = sendGetRequest(_controllerRequestURLBuilder.forSegmentMetadata(getTableName()));
JsonNode tableSegmentsMetadata = JsonUtils.stringToJsonNode(jsonOutputStr);
Assert.assertEquals(tableSegmentsMetadata.size(), 8);

JsonNode segmentMetadataFromAllEndpoint = tableSegmentsMetadata.elements().next();
String segmentName = URLEncoder.encode(segmentMetadataFromAllEndpoint.get("segmentName").asText(),
"UTF-8");
jsonOutputStr = sendGetRequest(
_controllerRequestURLBuilder.forSegmentMetadata(getTableName(), segmentName));
String segmentName = URLEncoder.encode(segmentMetadataFromAllEndpoint.get("segmentName").asText(), "UTF-8");
jsonOutputStr = sendGetRequest(_controllerRequestURLBuilder.forSegmentMetadata(getTableName(), segmentName));
JsonNode segmentMetadataFromDirectEndpoint = JsonUtils.stringToJsonNode(jsonOutputStr);
Assert.assertEquals(segmentMetadataFromAllEndpoint.get("totalDocs"),
segmentMetadataFromDirectEndpoint.get("segment.total.docs"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import java.util.List;
import java.util.Random;
import org.apache.commons.io.FileUtils;
import org.apache.pinot.spi.env.PinotConfiguration;
import org.apache.pinot.spi.utils.CommonConstants;
import org.apache.pinot.util.TestUtils;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
Expand Down Expand Up @@ -69,6 +71,11 @@ public void setUp()
waitForAllDocsLoaded(600_000L);
}

@Override
protected void overrideServerConf(PinotConfiguration configuration) {
configuration.setProperty(CommonConstants.Server.CONFIG_OF_REALTIME_OFFHEAP_ALLOCATION, false);
}

@Override
protected List<String> getNoDictionaryColumns() {
// Randomly set time column as no dictionary column.
Expand Down

0 comments on commit c6c8287

Please sign in to comment.