Skip to content
Open
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 @@ -38,11 +38,17 @@

import java.util.Collections;
import java.util.List;
import java.util.regex.Pattern;

/**
* show proc command
*/
public class ShowProcCommand extends ShowCommand {
// Match the repeated slashes and whitespace accepted by ProcService.open().
private static final Pattern LOCAL_QUERY_PATH = Pattern.compile(
"[ \\t\\r\\n]*/+(?:current_queries|current_query_stmts|current_backend_instances)/*(?:[ \\t\\r\\n].*)?",
Pattern.DOTALL);

private final String path;

/**
Expand Down Expand Up @@ -122,6 +128,10 @@ public <R, C> R accept(PlanVisitor<R, C> visitor, C context) {

@Override
public RedirectStatus toRedirectStatus() {
// These nodes read this FE's coordinators, not cluster-wide query state.
if (LOCAL_QUERY_PATH.matcher(path).matches()) {
return RedirectStatus.NO_FORWARD;
}
if (ConnectContext.get().getSessionVariable().getForwardToMaster()) {
return RedirectStatus.FORWARD_NO_SYNC;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,7 @@ public String toString() {

@Override
public RedirectStatus toRedirectStatus() {
if (ConnectContext.get().getSessionVariable().getForwardToMaster()) {
return RedirectStatus.FORWARD_NO_SYNC;
} else {
return RedirectStatus.NO_FORWARD;
}
// Running and waiting query counts belong to the local FE's query queues.
return RedirectStatus.NO_FORWARD;
}
}
Loading