[
https://issues.apache.org/jira/browse/BOOKKEEPER-300?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13439598#comment-13439598
]
Sijie Guo commented on BOOKKEEPER-300:
--------------------------------------
{code}
+ String instanceId = getInstanceId(zk);
boolean newEnv = false;
Cookie masterCookie = Cookie.generateCookie(conf);
+ if (null != instanceId) {
+ masterCookie.setInstanceId(instanceId);
+ }
try {
Cookie zkCookie = Cookie.readFromZooKeeper(zk, conf);
masterCookie.verify(zkCookie);
...
journalCookie.verify(masterCookie)
{code}
from the patch, first getInstanceId from zookeeper and set it into
masterCookie. then verify zkCookie and journalCookie.
since journalCookie/zkCookie is parsed from existed cookie data (which is
version 3), so the checking condition would be:
{code}
// the existed cookie (journalCookie/zkCookie) is old, but the cluster has
instanceid (which is new and formatted).
// so you should failed it.
if (c.layoutVersion == 3 && instanceId != null) {
throw new BookieException.InvalidCookieException(...);
}
// the existed cookie (journalCookie/zkCookie) is new format. to compare
instanceid.
if (c.layoutVersion == 4) {
if ((instanceId == null && c.instanceId != null) ||
(instanceId != null && !instanceId.equals(c.instanceId))) {
throw new BookieException.InvalidCookieException(...);
}
}
{code}
Does it make sense?
> Create Bookie format command
> ----------------------------
>
> Key: BOOKKEEPER-300
> URL: https://issues.apache.org/jira/browse/BOOKKEEPER-300
> Project: Bookkeeper
> Issue Type: New Feature
> Components: bookkeeper-server
> Affects Versions: 4.1.0
> Reporter: Rakesh R
> Attachments: BOOKKEEPER-300.patch, BOOKKEEPER-300.patch
>
>
> Provide a bookie format command. Then the admin would just have to run the
> command on each machine, which will prepare the bookie env
> +Zookeeper paths (znodes):+
> - ledger's root path
> - bookie's available path
> +Directories:+
> - Journal directories
> - Ledger directories
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira