I am working on moving namespace DDL to Proc-V2 and come to see this code.
Looks like the logic exists since St.Ack implemented namespace in
HBASE-8408.
I just wonder whether the failure of zookeeper update is serve enough to
shut down master (in my new code, I don't abort - I want to make sure that
the abort is not needed - note the upsert would fail if zookeep update
fails and rollback in my new code - so we will not have orphaned ns table
row)
private void upsert(Table table, NamespaceDescriptor ns) throws
IOException {
validateTableAndRegionCount(ns);
Put p = new Put(Bytes.toBytes(ns.getName()));
p.addImmutable(HTableDescriptor.NAMESPACE_FAMILY_INFO_BYTES,
HTableDescriptor.NAMESPACE_COL_DESC_BYTES,
ProtobufUtil.toProtoNamespaceDescriptor(ns).toByteArray());
table.put(p);
try {
zkNamespaceManager.update(ns);
} catch(IOException ex) {
String msg = "Failed to update namespace information in ZK. Aborting."
;
LOG.fatal(msg, ex);
masterServices.abort(msg, ex);
}
}