From d77ede4a29f415d6755d28a76abeaa39e5d34921 Mon Sep 17 00:00:00 2001 From: Yutong Xiao Date: Tue, 25 Jan 2022 14:48:56 +0800 Subject: [PATCH] HBASE-26688 Threads shared EMPTY_RESULT may lead to unexpected client job down. (#4048) Signed-off-by: Duo Zhang --- .../main/java/org/apache/hadoop/hbase/client/Result.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java index bff50338ba5f..b6c83f770b60 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java @@ -913,16 +913,19 @@ public CellScanner cellScanner() { @Override public Cell current() { - if (cells == null + if (isEmpty() || cellScannerIndex == INITIAL_CELLSCANNER_INDEX - || cellScannerIndex >= cells.length) + || cellScannerIndex >= cells.length) { return null; + } return this.cells[cellScannerIndex]; } @Override public boolean advance() { - if (cells == null) return false; + if (isEmpty()) { + return false; + } cellScannerIndex++; if (cellScannerIndex < this.cells.length) { return true;