nikhilerigila09 commented on code in PR #23274:
URL: https://github.com/apache/pulsar/pull/23274#discussion_r1750129564
##########
pulsar-common/src/main/java/org/apache/pulsar/common/nar/NarUnpacker.java:
##########
@@ -83,22 +83,31 @@ static File doUnpackNar(final File nar, final File
baseWorkingDirectory, Runnabl
synchronized (localLock) {
// create file lock that ensures that other processes
// using the same lock file don't execute concurrently
+ File successMarkerFile = new File(parentDirectory, "." + md5Sum +
".success");
try (FileChannel channel = new RandomAccessFile(lockFile,
"rw").getChannel();
FileLock lock = channel.lock()) {
File narWorkingDirectory = new File(parentDirectory, md5Sum);
- if (narWorkingDirectory.mkdir()) {
+ if (narWorkingDirectory.mkdir() ||
!successMarkerFile.exists()) {
try {
log.info("Extracting {} to {}", nar,
narWorkingDirectory);
if (extractCallback != null) {
extractCallback.run();
}
unpack(nar, narWorkingDirectory);
+ boolean successMarkerFileCreated =
successMarkerFile.createNewFile();
+ log.info("Successfully extracted nar file, status for
creating success marker at {} is {}",
+ successMarkerFile.getAbsolutePath(),
successMarkerFileCreated);
Review Comment:
if there is a restart after creating the `narWorkingDirectory` then we
would end up in the same situation
--
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]