You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2021/03/29 02:30:09 UTC

[GitHub] [incubator-doris] xinghuayu007 commented on a change in pull request #5578: [Bug] keytab file maybe not thread-safe

xinghuayu007 commented on a change in pull request #5578:
URL: https://github.com/apache/incubator-doris/pull/5578#discussion_r602980715



##########
File path: fs_brokers/apache_hdfs_broker/src/main/java/org/apache/doris/broker/hdfs/FileSystemManager.java
##########
@@ -268,7 +268,17 @@ public BrokerFileSystem getDistributedFileSystem(String path, Map<String, String
                         long currentTime = System.currentTimeMillis();
                         Random random = new Random(currentTime);
                         int randNumber = random.nextInt(10000);
-                        tmpFilePath = "/tmp/." + Long.toString(currentTime) + "_" + Integer.toString(randNumber);
+                        // different kerberos account has different file
+                        tmpFilePath = "/tmp/." + principal + "_" + Long.toString(currentTime) + "_" + Integer.toString(randNumber);
+                        // before write keytab content into a tmp file, delete if in case of old file confusion
+                        try {
+                            File file = new File(tmpFilePath);
+                            if(!file.delete()){
+                                logger.warn("delete tmp file:" +  tmpFilePath + " failed");
+                            }
+                        } catch (Exception e) {

Review comment:
       I think it is no need. If the same file exists, delete it will sucess. Mostly, the same file will not exist, delete it will failed. It is no need to warn any information. It is a method to make sure it will create a new file at any time.




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org