-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-28631 Show the create time of the replication peer #5954
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
base: master
Are you sure you want to change the base?
Conversation
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better add this to ReplicationPeerDescription instead of ReplicationPeerConfig?
It is not a config...
Ok, I understand |
Could we just use the creation time of the peer id znode or directory? If this is not stable, we could introduce a separated znode or file to store it. |
The latest code has been submitted, please review it if you have time. I use the creation time of the peer id znode to get the create time of the peer. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
...-replication/src/main/java/org/apache/hadoop/hbase/replication/FSReplicationPeerStorage.java
Show resolved
Hide resolved
public long getPeerCreateTime(String peerId) throws ReplicationException { | ||
long createTimeIfNodeExists; | ||
try { | ||
createTimeIfNodeExists = ZKUtil.getCreateTimeIfNodeExists(zookeeper, getPeerNode(peerId)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just return here? And what is the return value if the znode does not exist?
public static long getCreateTimeIfNodeExists(ZKWatcher zkw, String znode) throws KeeperException { | ||
try { | ||
Stat s = zkw.getRecoverableZooKeeper().exists(znode, false); | ||
return s != null ? s.getCtime() : -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, -1, then we'd better have a constant in the ReplicationPeerStorage interface so all the implementations follow the same pattern?
} catch (KeeperException e) { | ||
LOG.warn(zkw.prefix("Unable to get create time on znode (" + znode + ")"), e); | ||
zkw.keeperException(e); | ||
return -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we return -1 here instead of throwing exception out?
de4d772
to
b1d16ff
Compare
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
@@ -111,6 +114,8 @@ public void addPeer(String peerId, ReplicationPeerConfig peerConfig, boolean ena | |||
if (!enabled) { | |||
fs.createNewFile(new Path(peerDir, DISABLED_FILE)); | |||
} | |||
write(fs, peerDir, CREATE_TIME_FILE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For create time I do not think we need to use the special write method here? As we will never change it...
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
@@ -111,6 +113,7 @@ public void addPeer(String peerId, ReplicationPeerConfig peerConfig, boolean ena | |||
if (!enabled) { | |||
fs.createNewFile(new Path(peerDir, DISABLED_FILE)); | |||
} | |||
fs.createNewFile(new Path(peerDir, CREATE_TIME_FILE)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed it to just create this file and not add content. So I can use fs.getFileStatus(createTimeFile).getModificationTime() to get peer create time. @Apache9
When the table data needs to be migrated due to the closure of the computer room or the business side needs to have a primary and standby table, we need to create a peer.
By checking the creation time of the peer, we can understand when and what operations were performed, and the impact of these operations on the HBase system status.
When there is a problem with the HBase cluster, such as abnormal data synchronization, performance degradation, etc., displaying the creation time of the peer can help us quickly locate the possible source of the problem. For example, if a peer has a problem shortly after it is created, we can prioritize checking the configuration and status of the peer, optimize the related configuration of replication, etc.
Recording the creation time of the peer helps to audit and track system changes, ensuring that any changes to the replication configuration can be traced. This is very important for meeting data governance, security compliance, and business continuity requirements.