ableegoldman commented on a change in pull request #9978: URL: https://github.com/apache/kafka/pull/9978#discussion_r566559281
########## File path: streams/src/main/java/org/apache/kafka/streams/processor/internals/StateDirectory.java ########## @@ -133,6 +152,72 @@ private void configurePermissions(final File file) { } } + /** + * @return true if the state directory was successfully locked + */ + private boolean lockStateDirectory() { + final File lockFile = new File(stateDir, LOCK_FILE_NAME); + try { + stateDirLockChannel = FileChannel.open(lockFile.toPath(), StandardOpenOption.CREATE, StandardOpenOption.WRITE); + stateDirLock = tryLock(stateDirLockChannel); + } catch (final IOException e) { + log.error("Unable to lock the state directory due to unexpected exception", e); + throw new ProcessorStateException("Failed to lock the state directory during startup", e); + } + + return stateDirLock != null; + } + + public UUID initializeProcessId() { Review comment: I'll try it out with json. If we do use json, then we don't even need the version number right? As long as we only ever add fields then it should always be compatible. At least that's my understanding, I'm not a json expert ---------------------------------------------------------------- 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: us...@infra.apache.org