Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
Signed-off-by: xufei <[email protected]>
  • Loading branch information
windtalker committed Jun 10, 2022
1 parent 40e1a17 commit 873e982
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
16 changes: 15 additions & 1 deletion dbms/src/Flash/Mpp/MPPTunnelSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,26 @@ void MPPTunnelSetBase<Tunnel>::writeError(const String & msg)
}
catch (...)
{
tryLogCurrentException(log, "Failed to write error " + msg + " to tunnel: " + tunnel->id());
tunnel->close("Failed to write error msg to tunnel");
tryLogCurrentException(log, "Failed to write error " + msg + " to tunnel: " + tunnel->id());
}
}
}

template <typename Tunnel>
void MPPTunnelSetBase<Tunnel>::registerTunnel(const MPPTaskId & id, const TunnelPtr & tunnel)
{
if (id_to_index_map.find(id) != id_to_index_map.end())
throw Exception("the tunnel " + tunnel->id() + " has been registered");

id_to_index_map[id] = tunnels.size();
tunnels.push_back(tunnel);
if (!tunnel->isLocal())
{
remote_tunnel_cnt++;
}
}

template <typename Tunnel>
void MPPTunnelSetBase<Tunnel>::close(const String & reason)
{
Expand Down
15 changes: 2 additions & 13 deletions dbms/src/Flash/Mpp/MPPTunnelSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,12 @@ class MPPTunnelSetBase : private boost::noncopyable
void writeError(const String & msg);
void close(const String & reason);
void finishWrite();
void registerTunnel(const MPPTaskId & id, const TunnelPtr & tunnel);

TunnelPtr getTunnelById(const MPPTaskId & id);

uint16_t getPartitionNum() const { return tunnels.size(); }

void registerTunnel(const MPPTaskId & id, const TunnelPtr & tunnel)
{
if (id_to_index_map.find(id) != id_to_index_map.end())
throw Exception("the tunnel " + tunnel->id() + " has been registered");

id_to_index_map[id] = tunnels.size();
tunnels.push_back(tunnel);
if (!tunnel->isLocal())
{
remote_tunnel_cnt++;
}
}

int getRemoteTunnelCnt()
{
return remote_tunnel_cnt;
Expand Down

0 comments on commit 873e982

Please sign in to comment.