Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HBASE-27405 Fix the replication hfile/log cleaner report that the replication table does not exist #4811

Merged
merged 1 commit into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Up @@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, here we can only use Admin...

Anyone, can be a follow on issue to see if we can use master services directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Apache9 sir
Well, we can only use admin here, unless the masterServices is passed in the constructor of TableReplicationQueueStorage,so do we need to optimize further?

} catch (IOException e) {
throw new ReplicationException("failed to get replication queue table", e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ public void preClean() {
if (this.getConf() == null) {
return;
}
try {
Apache9 marked this conversation as resolved.
Show resolved Hide resolved
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down