[
https://issues.apache.org/jira/browse/ZOOKEEPER-1835?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13850998#comment-13850998
]
Bruno Freudensprung commented on ZOOKEEPER-1835:
------------------------------------------------
Hi Rakesh,
First of all, I apologize for mispelling your name in my last comment.
Please find attached the new patch including all your remarks (well, I hope
so). The only one that puzzled me was the "// and the caller will be notified
(IOException)", I didn't find anything special in it, except the extra spaces
after the // that I removed.
As you will see I have modified the try/catch/finally in a way that should
satisfy both of us: it does not duplicate code, it is simpler, and it now
resists to any kind of throwable (RuntimeException, Exception, Error) like
demonstrated into the new unit tests. I also modified the unit tests to test
that the tmp file is removed in any case.
I've tested the ZOOKEEPER-1691 patch in addition to this new one, and I still
got my dynamic reconfig scenario working like described in
https://issues.apache.org/jira/browse/ZOOKEEPER-1691
And I finally tested the configBackwardCompatibilityMode scenario where the
dynamic config file gets created and the zoo.cfg file rewritten. It still works
too.
I hope I have not forgotten anything!
Bruno.
> dynamic configuration file renaming fails on Windows
> ----------------------------------------------------
>
> Key: ZOOKEEPER-1835
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1835
> Project: ZooKeeper
> Issue Type: Bug
> Components: quorum
> Affects Versions: 3.5.0
> Environment: Windows 7 64-bit, Oracle Java 1.6.0_32-b05
> Reporter: Bruno Freudensprung
> Assignee: Bruno Freudensprung
> Fix For: 3.5.0
>
> Attachments: ZOOKEEPER-1835.patch, ZOOKEEPER-1835.patch
>
>
> On Windows, reconfig fails to rename the tmp dynamic config file to the real
> dynamic config filename.
> Javadoc of java.io.File.renameTo says the behavior is highly plateform
> dependent, so I guess this should not be a big surprise.
> The problem occurs in
> src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java that
> could be modified like this:
> + curFile.delete();
> if (!tmpFile.renameTo(curFile)) {
> + configFile.delete();
> if (!tmpFile.renameTo(configFile)) {
> As suggested by Alex in https://issues.apache.org/jira/browse/ZOOKEEPER-1691
> (btw there is more information about my test scenario over there) it is a bit
> "scary" to delete the current configuration file.
--
This message was sent by Atlassian JIRA
(v6.1.4#6159)