[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-1994?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14083039#comment-14083039
 ] 

Alexander Shraer commented on ZOOKEEPER-1994:
---------------------------------------------

For dynamic configuration files, here's where I'd start:

In QuorumPeer, setQuorumVerifier, before calling writeDynamicConfig update the 
dynamicConfigFilename to have the correct suffix of the new config version. 

In writeDynamicConfig change, instead of this
            public void write(OutputStream outConfig) throws IOException {
                byte b[] = qv.toString().getBytes();
                outConfig.write(b);
            }
I'd construct a Properties object first, and then write out all keys that are 
not "version".
Then you need to call editStaticConfig and update the link to the new file.

For loading the version, perhaps the easiest thing is after 
dynamicCfg.load(inConfig) in QuorumPeerConfig, 
add a pair to this Properites object with key="version" and value taken from 
the filename.




> Backup config files.
> --------------------
>
>                 Key: ZOOKEEPER-1994
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1994
>             Project: ZooKeeper
>          Issue Type: Improvement
>    Affects Versions: 3.5.0
>            Reporter: Hongchao Deng
>            Assignee: Hongchao Deng
>             Fix For: 3.5.0
>
>         Attachments: draft.patch, static-backup.patch
>
>
> We should create a backup file for a static or dynamic configuration file 
> before changing the file. 
> Since the static file is changed at most twice (once when removing the 
> ensemble definitions, at which point a dynamic file doesn't exist yet, and 
> once when removing clientPort information) its probably fine to back up the 
> static file independently from the dynamic file. 
> To track backup history:
> Option 1: we could have a .bakXX extention for backup where XX is a  sequence 
> number. 
> Option 2: have the configuration version be part of the file name for dynamic 
> configuration files (instead of in the file like now). Such as 
> zoo_replicated1.cfg.dynamic.1000000 then on reconfiguration simply create a 
> new dynamic file (with new version) and update the link in the static file to 
> point to the new dynamic one.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to