Skip to content

Commit

Permalink
build internal table in FeService
Browse files Browse the repository at this point in the history
  • Loading branch information
keanji-x committed Jul 19, 2023
1 parent c581cf3 commit ad35f5d
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class InternalSchemaInitializer extends Thread {
private static final Logger LOG = LogManager.getLogger(InternalSchemaInitializer.class);

public void run() {
if (FeConstants.disableInternalSchemaDb) {
if (!FeConstants.enableInternalSchemaDb) {
return;
}
while (!created()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public class FeConstants {
// set to true to skip some step when running FE unit test
public static boolean runningUnitTest = false;

// set to true to disable internal schema db
public static boolean disableInternalSchemaDb = false;
// set to false to disable internal schema db
public static boolean enableInternalSchemaDb = true;

// default scheduler interval is 10 seconds
public static int default_scheduler_interval_millisecond = 10000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.apache.doris.catalog.SchemaTable;
import org.apache.doris.catalog.TableIf;
import org.apache.doris.common.Config;
import org.apache.doris.common.FeConstants;
import org.apache.doris.common.Pair;
import org.apache.doris.nereids.CascadesContext;
import org.apache.doris.nereids.exceptions.AnalysisException;
Expand Down Expand Up @@ -596,7 +597,8 @@ private Statistics computeCatalogRelation(CatalogRelation catalogRelation) {
if (colName == null) {
throw new RuntimeException(String.format("Invalid slot: %s", slotReference.getExprId()));
}
ColumnStatistic cache = Config.enable_stats ? getColumnStatistic(table, colName) : ColumnStatistic.UNKNOWN;
ColumnStatistic cache = Config.enable_stats && FeConstants.enableInternalSchemaDb
? getColumnStatistic(table, colName) : ColumnStatistic.UNKNOWN;
if (cache.avgSizeByte <= 0) {
cache = new ColumnStatisticBuilder(cache)
.setAvgSizeByte(slotReference.getColumn().get().getType().getSlotSize())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,9 @@

package org.apache.doris.nereids.datasets.tpch;

import org.apache.doris.catalog.InternalSchemaInitializer;
import org.apache.doris.common.FeConstants;

public abstract class TPCHTestBase extends AnalyzeCheckTestBase {
@Override
protected void runBeforeAll() throws Exception {
// The internal table for TPCHTestBase is constructed in order to facilitate
// the execution of certain tests that require the invocation of a deriveStats job.
// This deriveStats job is responsible for retrieving statistics from the aforementioned
// internal table.
FeConstants.disableInternalSchemaDb = false;
new InternalSchemaInitializer().start();
createDatabase("tpch");
connectContext.setDatabase("default_cluster:tpch");
TPCHUtils.createTables(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import org.apache.doris.catalog.Database;
import org.apache.doris.catalog.DiskInfo;
import org.apache.doris.catalog.Env;
import org.apache.doris.catalog.InternalSchemaInitializer;
import org.apache.doris.catalog.OlapTable;
import org.apache.doris.catalog.Replica;
import org.apache.doris.catalog.Table;
Expand Down Expand Up @@ -129,12 +128,11 @@ public abstract class TestWithFeService {

@BeforeAll
public final void beforeAll() throws Exception {
FeConstants.disableInternalSchemaDb = true;
FeConstants.enableInternalSchemaDb = false;
beforeCreatingConnectContext();
connectContext = createDefaultCtx();
beforeCluster();
createDorisCluster();
new InternalSchemaInitializer().start();
runBeforeAll();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public static void createDorisCluster(String runningDir) throws InterruptedExcep

public static void createDorisCluster(String runningDir, int backendNum) throws EnvVarNotSetException, IOException,
FeStartException, NotInitException, DdlException, InterruptedException {
FeConstants.disableInternalSchemaDb = true;
FeConstants.enableInternalSchemaDb = false;
int feRpcPort = startFEServer(runningDir);
List<Backend> bes = Lists.newArrayList();
for (int i = 0; i < backendNum; i++) {
Expand Down Expand Up @@ -245,7 +245,7 @@ public static void createDorisClusterWithMultiTag(String runningDir, int backend
// set runningUnitTest to true, so that for ut,
// the agent task will be sent to "127.0.0.1" to make cluster running well.
FeConstants.runningUnitTest = true;
FeConstants.disableInternalSchemaDb = true;
FeConstants.enableInternalSchemaDb = false;
int feRpcPort = startFEServer(runningDir);
for (int i = 0; i < backendNum; i++) {
String host = "127.0.0." + (i + 1);
Expand Down

0 comments on commit ad35f5d

Please sign in to comment.