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

Rakesh R commented on BOOKKEEPER-634:
-------------------------------------

Hi,

*Proposal-1*
Attached latest patch, here I've tried diff approach to do the cookie changes. 
Say, bookieid is 10.40.12.20 and its hosts HOST20. Assume bookie previously 
started and cookie contains /ledgers/cookies/10.40.12.20:8080

step-1) At the end of renamebookieid shell command, create an empty 'HOST20' 
znode under /ledgers/cookies/ path. Now zk contains 
/ledgers/cookies/10.40.12.20:8080, /ledgers/cookies/HOST20:8080

step-2) During bookie startup, it will do cookie verification using 
/ledgers/cookies/10.40.12.20:8080. After the successful verification it will 
rename the cookies as follows:
        - (a) check znode exists /ledgers/cookies/HOST20:8080 && 
useHostNameAsBookieID != prev
        - (b) if yes, generate new cookie by setting 'useHostNameAsBookieID' 
flag
        - (c) write to journal dir
        - (d) write to ledger dirs
        - (e) write /ledgers/cookies/HOST20:8080 to ZooKeeper
        - (f) delete prev znode /ledgers/cookies/10.40.12.20:8080 from ZooKeeper

+Following are few more imprv, but I think will start implementing it after we 
agreed upon the proposal+

+Imprv-1)+ Guarantee operations (c), (d), (e) atomic using marker file. But I 
feel this has its own complexity.
( i ) create a marker file in the journal dir saying RENAMEBOOKIEID_INPROGRESS
(ii ) All the dirs, first rename the VERSION file to VERSION.tmp, then creates 
new VERSION file based on generated cookie
(iii) delete and create /ledgers/cookies/HOST20:8080 in ZK
(iv) delete the prev znode from ZooKeeper
(v ) delete VERSION.tmp from all the dirs
(vi) delete /ledgers/cookies/10.40.12.20:8080 from ZooKeeper
(vii) delete RENAMEBOOKIEID_INPROGRESS marker file.
Now during bookie startup if RENAMEBOOKIEID_INPROGRESS and VERSION.tmp exists 
verify against old cookie. Otw use VERSION for verification.

+Imprv-2)+ If requires we can also think of providing extra logic of 
dynamically modifying the cookie by watching /ledgers/cookies/HOST20:8080 
creation and perform the same steps mentioned above in bookie startup..

+Imprv-3)+ Bookishell command needs to be like 'renamebookieid' instead of 
'renamebookieidinledger'


*Proposal-2*
Do renaming of bookies by introducing separate arg like below during file 
system upgrade.

-upgrade cookies

\\
\\
I've tried Proposal-1 though it is complex. The reason is, this is not a kind 
of upgradation its more or less like renaming of bookieid.

Any thoughts?

Thanks,
Rakesh

> Provide admin tool to change bookie's identifier from IP to hostname
> --------------------------------------------------------------------
>
>                 Key: BOOKKEEPER-634
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-634
>             Project: Bookkeeper
>          Issue Type: Sub-task
>          Components: bookkeeper-client, bookkeeper-server
>    Affects Versions: 4.2.1
>            Reporter: Rakesh R
>            Assignee: Rakesh R
>             Fix For: 4.3.0
>
>         Attachments: 0001-BOOKKEEPER-634-initial-draft-version.patch, 
> BOOKKEEPER-634.patch, BOOKKEEPER-634.patch
>
>
> This JIRA to discuss about admin tool for changing the bookie's IP to 
> hostname.



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

Reply via email to