Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement](broker-load) enable memtable on sink node for broker load by session var #28894

Merged
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 @@ -83,6 +83,8 @@ public class BrokerLoadJob extends BulkLoadJob {
// If set to true, the profile of load job with be pushed to ProfileManager
private boolean enableProfile = false;

private boolean enableMemTableOnSinkNode = false;

// for log replay and unit test
public BrokerLoadJob() {
super(EtlJobType.BROKER);
Expand All @@ -93,8 +95,9 @@ public BrokerLoadJob(long dbId, String label, BrokerDesc brokerDesc,
throws MetaNotFoundException {
super(EtlJobType.BROKER, dbId, label, originStmt, userInfo);
this.brokerDesc = brokerDesc;
if (ConnectContext.get() != null && ConnectContext.get().getSessionVariable().enableProfile()) {
enableProfile = true;
if (ConnectContext.get() != null) {
enableProfile = ConnectContext.get().getSessionVariable().enableProfile();
enableMemTableOnSinkNode = ConnectContext.get().getSessionVariable().enableMemtableOnSinkNode;
}
}

Expand Down Expand Up @@ -212,7 +215,7 @@ brokerFileGroups, getDeadlineMs(), getExecMemLimit(),
isStrictMode(), isPartialUpdate(), transactionId, this, getTimeZone(), getTimeout(),
getLoadParallelism(), getSendBatchParallelism(),
getMaxFilterRatio() <= 0, enableProfile ? jobProfile : null, isSingleTabletLoadPerSink(),
useNewLoadScanNode(), getPriority());
useNewLoadScanNode(), getPriority(), enableMemTableOnSinkNode);

UUID uuid = UUID.randomUUID();
TUniqueId loadId = new TUniqueId(uuid.getMostSignificantBits(), uuid.getLeastSignificantBits());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public class LoadLoadingTask extends LoadTask {
private final boolean singleTabletLoadPerSink;
private final boolean useNewLoadScanNode;

private final boolean enableMemTableOnSinkNode;

private LoadingTaskPlanner planner;

private Profile jobProfile;
Expand All @@ -83,7 +85,7 @@ public LoadLoadingTask(Database db, OlapTable table,
long txnId, LoadTaskCallback callback, String timezone,
long timeoutS, int loadParallelism, int sendBatchParallelism,
boolean loadZeroTolerance, Profile jobProfile, boolean singleTabletLoadPerSink,
boolean useNewLoadScanNode, Priority priority) {
boolean useNewLoadScanNode, Priority priority, boolean enableMemTableOnSinkNode) {
super(callback, TaskType.LOADING, priority);
this.db = db;
this.table = table;
Expand All @@ -104,6 +106,7 @@ public LoadLoadingTask(Database db, OlapTable table,
this.jobProfile = jobProfile;
this.singleTabletLoadPerSink = singleTabletLoadPerSink;
this.useNewLoadScanNode = useNewLoadScanNode;
this.enableMemTableOnSinkNode = enableMemTableOnSinkNode;
}

public void init(TUniqueId loadId, List<List<TBrokerFileStatus>> fileStatusList,
Expand Down Expand Up @@ -152,6 +155,7 @@ private void executeOnce() throws Exception {
*/
curCoordinator.setLoadMemLimit(execMemLimit);
curCoordinator.setTimeout((int) (getLeftTimeMs() / 1000));
curCoordinator.setMemTableOnSinkNode(enableMemTableOnSinkNode);

try {
QeProcessorImpl.INSTANCE.registerQuery(loadId, curCoordinator);
Expand Down
4 changes: 4 additions & 0 deletions fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java
Original file line number Diff line number Diff line change
Expand Up @@ -2656,6 +2656,10 @@ public boolean isDone() {
}
}

public void setMemTableOnSinkNode(boolean enableMemTableOnSinkNode) {
this.queryOptions.setEnableMemtableOnSinkNode(enableMemTableOnSinkNode);
}

// map from a BE host address to the per-node assigned scan ranges;
// records scan range assignment for a single fragment
static class FragmentScanRangeAssignment
Expand Down