MCPcopy Create free account
hub / github.com/apache/mesos / create

Method create

src/zookeeper/group.cpp:412–443  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

410
411
412Try<bool> GroupProcess::create()
413{
414 CHECK_EQ(state, AUTHENTICATED);
415
416 // Create znode path (including intermediate znodes) as necessary.
417 CHECK(znode.size() == 0 || znode.at(znode.size() - 1) != '/');
418
419 LOG(INFO) << "Trying to create path '" << znode << "' in ZooKeeper";
420
421 int code = zk->create(znode, "", acl, 0, nullptr, true);
422
423 // We fail all non-retryable return codes except ZNONODEEXISTS (
424 // since that means the path we were trying to create exists). Note
425 // that it's also possible we got back a ZNONODE because we could
426 // not create one of the intermediate znodes (in which case we'll
427 // abort in the 'else if' below since ZNONODE is non-retryable).
428 // Also note that it's possible that the intermediate path exists
429 // but we don't have permission to know it, in this case we abort
430 // as well to be on the safe side
431 // TODO(benh): Need to check that we also can put a watch on the
432 // children of 'znode'.
433 if (code == ZINVALIDSTATE || (code != ZOK && zk->retryable(code))) {
434 CHECK_NE(zk->getState(), ZOO_AUTH_FAILED_STATE);
435 return false;
436 } else if (code != ZOK && code != ZNODEEXISTS) {
437 return Error(
438 "Failed to create '" + znode + "' in ZooKeeper: " + zk->message(code));
439 }
440
441 state = READY;
442 return true;
443}
444
445
446void GroupProcess::reconnecting(int64_t sessionId)

Callers 1

doJoinMethod · 0.45

Calls 6

atMethod · 0.80
retryableMethod · 0.80
ErrorFunction · 0.50
sizeMethod · 0.45
getStateMethod · 0.45
messageMethod · 0.45

Tested by

no test coverage detected