You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2020/04/16 15:04:41 UTC
[hbase] branch branch-2.3 updated: HBASE-24158 [Flakey Tests]
TestAsyncTableGetMultiThreaded Addendum to address NPE
This is an automated email from the ASF dual-hosted git repository.
stack pushed a commit to branch branch-2.3
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.3 by this push:
new e1dcc7b HBASE-24158 [Flakey Tests] TestAsyncTableGetMultiThreaded Addendum to address NPE
e1dcc7b is described below
commit e1dcc7bdcaac62c51f9755cabfae09076963ed47
Author: stack <st...@apache.org>
AuthorDate: Thu Apr 16 08:02:33 2020 -0700
HBASE-24158 [Flakey Tests] TestAsyncTableGetMultiThreaded
Addendum to address NPE
---
.../apache/hadoop/hbase/client/AsyncRegionLocatorHelper.java | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRegionLocatorHelper.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRegionLocatorHelper.java
index 764650a..4c6cd5a 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRegionLocatorHelper.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRegionLocatorHelper.java
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -19,7 +19,6 @@ package org.apache.hadoop.hbase.client;
import static org.apache.hadoop.hbase.exceptions.ClientExceptionsUtil.findException;
import static org.apache.hadoop.hbase.exceptions.ClientExceptionsUtil.isMetaClearingException;
-
import java.util.Arrays;
import java.util.function.Consumer;
import java.util.function.Function;
@@ -45,7 +44,13 @@ final class AsyncRegionLocatorHelper {
static boolean canUpdateOnError(HRegionLocation loc, HRegionLocation oldLoc) {
// Do not need to update if no such location, or the location is newer, or the location is not
// the same with us
- return oldLoc != null && oldLoc.getSeqNum() <= loc.getSeqNum() &&
+ if (loc == null || loc.getServerName() == null) {
+ return false;
+ }
+ if (oldLoc == null || oldLoc.getServerName() == null) {
+ return false;
+ }
+ return oldLoc.getSeqNum() <= loc.getSeqNum() &&
oldLoc.getServerName().equals(loc.getServerName());
}