Apache9 commented on code in PR #8426:
URL: https://github.com/apache/hbase/pull/8426#discussion_r3488927179
##########
hbase-common/src/test/java/org/apache/hadoop/hbase/io/crypto/tls/X509TestContext.java:
##########
@@ -187,85 +188,68 @@ public File getTrustStoreFile(KeyStoreFileType
storeFileType) throws IOException
}
}
- private File getTrustStoreJksFile() throws IOException {
+ private void atomicWriteFile(File file, byte[] content) throws IOException {
+ File tmpFile = new File(file.getParentFile(),
file.getName().concat(".tmp"));
+ Files.write(tmpFile.toPath(), content, StandardOpenOption.CREATE,
+ StandardOpenOption.TRUNCATE_EXISTING);
+ Files.move(tmpFile.toPath(), file.toPath(),
StandardCopyOption.REPLACE_EXISTING,
+ StandardCopyOption.ATOMIC_MOVE);
+ }
Review Comment:
We need atomic move to make the test stable.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]