Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HBASE-27405 Fix the replication hfile/log cleaner report that the rep…
Browse files Browse the repository at this point in the history
…lication table does not exist (#4811)

Signed-off-by: Duo Zhang <zhangduo@apache.org>
2005hithlj authored and Apache9 committed Mar 13, 2023
1 parent 2f0f97e commit b552ad2
Showing 4 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -178,4 +178,10 @@ void removeLastSequenceIds(String peerId, List<String> encodedRegionNames)
* created hfile references during the call may not be included.
*/
Set<String> getAllHFileRefs() throws ReplicationException;

/**
* Whether the replication queue table exists.
* @return Whether the replication queue table exists
*/
boolean hasData() throws ReplicationException;
}
Original file line number Diff line number Diff line change
@@ -532,4 +532,13 @@ public Set<String> getAllHFileRefs() throws ReplicationException {
throw new ReplicationException("failed to getAllHFileRefs", e);
}
}

@Override
public boolean hasData() throws ReplicationException {
try {
return conn.getAdmin().getDescriptor(tableName) != null;
} catch (IOException e) {
throw new ReplicationException("failed to get replication queue table", e);
}
}
}
Original file line number Diff line number Diff line change
@@ -76,6 +76,14 @@ public void preClean() {
if (this.getConf() == null) {
return;
}
try {
if (!rpm.getQueueStorage().hasData()) {
return;
}
} catch (ReplicationException e) {
LOG.error("Error occurred while executing queueStorage.hasData()", e);
return;
}
canFilter = rpm.getReplicationLogCleanerBarrier().start();
if (canFilter) {
notFullyDeadServers = getNotFullyDeadServers.get();
Original file line number Diff line number Diff line change
@@ -86,6 +86,7 @@ public void setUp() throws ReplicationException {
when(rpm.listPeers(null)).thenReturn(new ArrayList<>());
ReplicationQueueStorage rqs = mock(ReplicationQueueStorage.class);
when(rpm.getQueueStorage()).thenReturn(rqs);
when(rpm.getQueueStorage().hasData()).thenReturn(true);
when(rqs.listAllQueues()).thenReturn(new ArrayList<>());
ServerManager sm = mock(ServerManager.class);
when(services.getServerManager()).thenReturn(sm);

0 comments on commit b552ad2

Please sign in to comment.