iamcaoxudong commented on a change in pull request #1700: HDFS-14963. Add HDFS
Client machine caching active namenode index mechanism.
URL: https://github.com/apache/hadoop/pull/1700#discussion_r351762620
##########
File path:
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/ConfiguredFailoverProxyProvider.java
##########
@@ -93,4 +109,65 @@ public synchronized void close() throws IOException {
public boolean useLogicalURI() {
return true;
}
+
+ /**
+ * Write active NameNode index to cache file.
+ */
+ public void writeActiveCache(int index) {
+ if (!cacheActiveEnabled) {
+ return;
+ }
+
+ synchronized (cacheActiveFile) {
+ boolean exist = cacheActiveFile.exists();
+ try (RandomAccessFile raf = new RandomAccessFile(cacheActiveFile, "rw");
+ FileChannel fc = raf.getChannel();
+ FileLock lock = fc.tryLock(0, Long.MAX_VALUE, false)) {
Review comment:
Yes, according to my tests, after a process ends, the linux kernel releases
all resources it holds, including locks.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]