Class ZNodeClearer
Contains a set of methods for the collaboration between the start/stop scripts and the servers. It allows to delete immediately the znode when the master or the regions server crashes. The region server / master writes a specific file when it starts / becomes main master. When they end properly, they delete the file.
In the script, we check for the existence of these files when the program ends. If they still exist we conclude that the server crashed, likely without deleting their znode. To have a faster recovery we delete immediately the znode.
The strategy depends on the server type. For a region server we store the znode path in the file, and use it to delete it. for a master, as the znode path constant whatever the server, we check its content to make sure that the backup server is not now in charge.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
clear
(org.apache.hadoop.conf.Configuration conf) Delete the master znode if its content (ServerName string) is the same as the one in the znode file.static void
delete the znode filestatic String
Get the name of the file used to store the znode contentsstatic String
parseMasterServerName
(String rsZnodePath) See HBASE-14861.static String
read the content of znode file, expects a single line.private static boolean
tablesOnMaster
(org.apache.hadoop.conf.Configuration conf) Deprecated.since 2.4.0, will be removed in 3.0.0.static void
writeMyEphemeralNodeOnDisk
(String fileContent) Logs the errors without failing on exception.
-
Field Details
-
LOG
-
-
Constructor Details
-
ZNodeClearer
private ZNodeClearer()
-
-
Method Details
-
writeMyEphemeralNodeOnDisk
Logs the errors without failing on exception. -
readMyEphemeralNodeOnDisk
read the content of znode file, expects a single line.- Throws:
IOException
-
getMyEphemeralNodeFileName
Get the name of the file used to store the znode contents -
deleteMyEphemeralNodeOnDisk
delete the znode file -
parseMasterServerName
See HBASE-14861. We are extracting master ServerName from rsZnodePath example: "/hbase/rs/server.example.com,16020,1448266496481"- Parameters:
rsZnodePath
- from HBASE_ZNODE_FILE- Returns:
- String representation of ServerName or null if fails
-
tablesOnMaster
Deprecated.since 2.4.0, will be removed in 3.0.0.- Returns:
- true if cluster is configured with master-rs collocation
- See Also:
-
clear
Delete the master znode if its content (ServerName string) is the same as the one in the znode file. (env: HBASE_ZNODE_FILE). I case of master-rs colloaction we extract ServerName string from rsZnode path.(HBASE-14861)- Returns:
- true on successful deletion, false otherwise.
-