Skip to content

Commit

Permalink
HBASE-22150 rssStub in HRegionServer is not thread safe and should no…
Browse files Browse the repository at this point in the history
…t directly be used

Signed-off-by: Sergey Shelukhin <[email protected]>
  • Loading branch information
Bahram Chehrazy authored and sershe-apache committed Apr 17, 2019
1 parent 8ec93ea commit 428afa9
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2431,12 +2431,13 @@ public void abort(String reason, Throwable cause) {
msg += "\nCause:\n" + Throwables.getStackTraceAsString(cause);
}
// Report to the master but only if we have already registered with the master.
if (rssStub != null && this.serverName != null) {
RegionServerStatusService.BlockingInterface rss = rssStub;
if (rss != null && this.serverName != null) {
ReportRSFatalErrorRequest.Builder builder =
ReportRSFatalErrorRequest.newBuilder();
builder.setServer(ProtobufUtil.toServerName(this.serverName));
builder.setErrorMessage(msg);
rssStub.reportRSFatalError(null, builder.build());
rss.reportRSFatalError(null, builder.build());
}
} catch (Throwable t) {
LOG.warn("Unable to report fatal error to master", t);
Expand Down Expand Up @@ -2645,7 +2646,8 @@ private boolean keepLooping() {
private RegionServerStartupResponse reportForDuty() throws IOException {
if (this.masterless) return RegionServerStartupResponse.getDefaultInstance();
ServerName masterServerName = createRegionServerStatusStub(true);
if (masterServerName == null) return null;
RegionServerStatusService.BlockingInterface rss = rssStub;
if (masterServerName == null || rss == null) return null;
RegionServerStartupResponse result = null;
try {
rpcServices.requestCount.reset();
Expand All @@ -2664,7 +2666,7 @@ private RegionServerStartupResponse reportForDuty() throws IOException {
request.setPort(port);
request.setServerStartCode(this.startcode);
request.setServerCurrentTime(now);
result = this.rssStub.regionServerStartup(null, request.build());
result = rss.regionServerStartup(null, request.build());
} catch (ServiceException se) {
IOException ioe = ProtobufUtil.getRemoteException(se);
if (ioe instanceof ClockOutOfSyncException) {
Expand Down

0 comments on commit 428afa9

Please sign in to comment.