[Bugs] Fix bugs that FE heartbeat api of httpv2 does not return version info (#5306)
Co-authored-by: morningman <chenmingyu@baidu.com>
This commit is contained in:
@ -389,7 +389,7 @@ bool BrokerScanner::line_to_src_tuple(const Slice& line) {
|
||||
if (!validate_utf8(line.data, line.size)) {
|
||||
std::stringstream error_msg;
|
||||
error_msg << "data is not encoded by UTF-8";
|
||||
_state->append_error_msg_to_file(std::string(line.data, line.size), error_msg.str());
|
||||
_state->append_error_msg_to_file("Unable to display", error_msg.str());
|
||||
_counter->num_rows_filtered++;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -19,6 +19,7 @@ package org.apache.doris.httpv2.rest;
|
||||
|
||||
import org.apache.doris.catalog.Catalog;
|
||||
import org.apache.doris.common.Config;
|
||||
import org.apache.doris.common.Version;
|
||||
import org.apache.doris.httpv2.entity.ResponseEntityBuilder;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
@ -54,6 +55,7 @@ public class BootstrapFinishAction {
|
||||
public static final String REPLAYED_JOURNAL_ID = "replayedJournalId";
|
||||
public static final String QUERY_PORT = "queryPort";
|
||||
public static final String RPC_PORT = "rpcPort";
|
||||
public static final String VERSION = "version";
|
||||
|
||||
@RequestMapping(path = "/api/bootstrap", method = RequestMethod.GET)
|
||||
public ResponseEntity execute(HttpServletRequest request, HttpServletResponse response) {
|
||||
@ -73,12 +75,10 @@ public class BootstrapFinishAction {
|
||||
return ResponseEntityBuilder.badRequest("invalid cluster id format: " + clusterIdStr);
|
||||
}
|
||||
|
||||
|
||||
if (clusterId != Catalog.getCurrentCatalog().getClusterId()) {
|
||||
return ResponseEntityBuilder.okWithCommonError("invalid cluster id: " + clusterId);
|
||||
}
|
||||
|
||||
|
||||
if (!token.equals(Catalog.getCurrentCatalog().getToken())) {
|
||||
return ResponseEntityBuilder.okWithCommonError("invalid token: " + token);
|
||||
}
|
||||
@ -88,6 +88,7 @@ public class BootstrapFinishAction {
|
||||
result.setReplayedJournalId(replayedJournalId);
|
||||
result.setQueryPort(Config.query_port);
|
||||
result.setRpcPort(Config.rpc_port);
|
||||
result.setVersion(Version.DORIS_BUILD_VERSION + "-" + Version.DORIS_BUILD_SHORT_HASH);
|
||||
}
|
||||
|
||||
return ResponseEntityBuilder.ok(result);
|
||||
@ -103,6 +104,7 @@ public class BootstrapFinishAction {
|
||||
private long replayedJournalId = 0;
|
||||
private int queryPort = 0;
|
||||
private int rpcPort = 0;
|
||||
private String version = "";
|
||||
|
||||
public BootstrapResult() {
|
||||
|
||||
@ -131,5 +133,14 @@ public class BootstrapFinishAction {
|
||||
public int getRpcPort() {
|
||||
return rpcPort;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -327,9 +327,9 @@ public class HeartbeatMgr extends MasterDaemon {
|
||||
long replayedJournalId = dataObj.getLong(BootstrapFinishAction.REPLAYED_JOURNAL_ID);
|
||||
int queryPort = dataObj.getInt(BootstrapFinishAction.QUERY_PORT);
|
||||
int rpcPort = dataObj.getInt(BootstrapFinishAction.RPC_PORT);
|
||||
// TODO(wb) support new return for version here
|
||||
String version = dataObj.getString(BootstrapFinishAction.VERSION);
|
||||
return new FrontendHbResponse(fe.getNodeName(), queryPort, rpcPort, replayedJournalId,
|
||||
System.currentTimeMillis(), "unknown");
|
||||
System.currentTimeMillis(), version);
|
||||
}
|
||||
} else {
|
||||
throw new Exception("invalid return value: " + result);
|
||||
|
||||
Reference in New Issue
Block a user