Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -504,6 +504,15 @@ private void initialize() {
}
}

if (peerClusterId == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think here we just need to add the same check like above?

    if (!this.isSourceActive()) {
      return;
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually this makes more sense. Thanks for the idea.

// In some cases, it is possible that peerClusterId is null because it couldn't read
// peer cluster id from zookeeper. One case this might happen is because 2 clusters don't
// have kerberos trust setup.
this.terminate("Peer ClusterId returned is null", null, false);
this.manager.removeSource(this);
return;
}

// In rare case, zookeeper setting may be messed up. That leads to the incorrect
// peerClusterId value, which is the same as the source clusterId
if (clusterId.equals(peerClusterId) && !replicationEndpoint.canReplicateToSameCluster()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,10 @@ public void refreshSources(String peerId) throws IOException {
LOG.info("Terminate replication source for " + toRemove.getPeerId());
toRemove.terminate(terminateMessage);
}
for (NavigableSet<String> walsByGroup : walsById.get(peerId).values()) {
walsByGroup.forEach(wal -> src.enqueueLog(new Path(this.logDir, wal)));
if (walsById.get(peerId) != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

And is this possible? In the addSource method, we will always put a Map into the walsByGroup for the corresponding peerId. Notice that the code for branch-2 have been changed a lot from branch-1 so...

for (NavigableSet<String> walsByGroup : walsById.get(peerId).values()) {
walsByGroup.forEach(wal -> src.enqueueLog(new Path(this.logDir, wal)));
}
}
}
LOG.info("Startup replication source for " + src.getPeerId());
Expand Down