Skip to content

Commit

Permalink
[fix](stats) Fix analyze failed when there are thousands of partition…
Browse files Browse the repository at this point in the history
…s. (#24521)

It's caused by we used same query id for multiple queries of same olap analyze task, but many structures related to query execution depends on query id.
  • Loading branch information
Kikyou1997 authored and xiaokang committed Sep 18, 2023
1 parent a067946 commit 0720833
Show file tree
Hide file tree
Showing 3 changed files with 817 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2453,6 +2453,10 @@ public StatementBase setParsedStmt(StatementBase parsedStmt) {
}

public List<ResultRow> executeInternalQuery() {
LOG.debug("INTERNAL QUERY: " + originStmt.toString());
UUID uuid = UUID.randomUUID();
TUniqueId queryId = new TUniqueId(uuid.getMostSignificantBits(), uuid.getLeastSignificantBits());
context.setQueryId(queryId);
try {
List<ResultRow> resultRows = new ArrayList<>();
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
import org.apache.doris.statistics.StatisticConstants;
import org.apache.doris.statistics.util.InternalQueryResult.ResultRow;
import org.apache.doris.system.SystemInfoService;
import org.apache.doris.thrift.TUniqueId;

import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
Expand Down Expand Up @@ -96,7 +95,6 @@
import java.util.Objects;
import java.util.Optional;
import java.util.StringJoiner;
import java.util.UUID;
import java.util.function.Function;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -184,9 +182,6 @@ public static AutoCloseConnectContext buildConnectContext() {
connectContext.setDatabase(FeConstants.INTERNAL_DB_NAME);
connectContext.setQualifiedUser(UserIdentity.ROOT.getQualifiedUser());
connectContext.setCurrentUserIdentity(UserIdentity.ROOT);
UUID uuid = UUID.randomUUID();
TUniqueId queryId = new TUniqueId(uuid.getMostSignificantBits(), uuid.getLeastSignificantBits());
connectContext.setQueryId(queryId);
connectContext.setStartTime();
connectContext.setCluster(SystemInfoService.DEFAULT_CLUSTER);
return new AutoCloseConnectContext(connectContext);
Expand Down
Loading

0 comments on commit 0720833

Please sign in to comment.