/** * TODO: purge this once RM is doing the work * * @throws IOException */ protected void setupInitialRegistryPaths() throws IOException { if (registryOperations instanceof RMRegistryOperationsService) { RMRegistryOperationsService rmRegOperations = (RMRegistryOperationsService) registryOperations; rmRegOperations.initUserRegistryAsync(jstormMasterContext.service_user_name); } }
@Override public RMRegistryOperationsService run() throws Exception { RMRegistryOperationsService operations = new RMRegistryOperationsService("rmregistry", secureZK); addToTeardown(operations); operations.init(secureConf); LOG.info(operations.bindingDiagnosticDetails()); operations.start(); return operations; } });
String id = "username"; String pass = "password"; registryAdmin.addWriteAccessor(id, pass); List<ACL> clientAcls = registryAdmin.getClientAcls(); LOG.info("Client ACLS=\n{}", RegistrySecurity.aclsToString(clientAcls)); registryAdmin.mknode(base, false); List<ACL> baseACLs = registryAdmin.zkGetACLS(base); String aclset = RegistrySecurity.aclsToString(baseACLs); LOG.info("Base ACLs=\n{}", aclset); operations.stat(base); operations.mknode(base + "/subdir", false); ZKPathDumper pathDumper = registryAdmin.dumpPath(true); LOG.info(pathDumper.toString());
@Before public void setupRegistry() throws IOException { registry = new RMRegistryOperationsService("yarnRegistry"); operations = registry; registry.init(createRegistryConfiguration()); registry.start(); operations.delete("/", true); registry.createRootRegistryPaths(); addToTeardown(registry); }
/** * Actions to take when the AM container is completed * @param id container ID * @throws IOException problems */ public void onContainerFinished(ContainerId id) throws IOException { LOG.info("Container {} finished, purging container-level records", id); purgeRecordsAsync("/", id.toString(), PersistencePolicies.CONTAINER); }
/** * test that ZK can write as itself * @throws Throwable */ @Test public void testZookeeperCanWriteUnderSystem() throws Throwable { RMRegistryOperationsService rmRegistryOperations = startRMRegistryOperations(); RegistryOperations operations = rmRegistryOperations; operations.mknode(PATH_SYSTEM_SERVICES + "hdfs", false); ZKPathDumper pathDumper = rmRegistryOperations.dumpPath(true); LOG.info(pathDumper.toString()); }
/** * remove all application attempt entries * @param attemptId attempt ID */ protected void purgeAppAttemptRecords(ApplicationAttemptId attemptId) { purgeRecordsAsync("/", attemptId.toString(), PersistencePolicies.APPLICATION_ATTEMPT); }
/** * TODO: purge this once RM is doing the work * * @throws IOException */ protected void setupInitialRegistryPaths() throws IOException { if (registryOperations instanceof RMRegistryOperationsService) { RMRegistryOperationsService rmRegOperations = (RMRegistryOperationsService) registryOperations; rmRegOperations.initUserRegistryAsync(RegistryUtils.currentUser()); } }
/** * Actions to take when an application is completed * @param id application ID * @throws IOException problems */ public void onApplicationCompleted(ApplicationId id) throws IOException { LOG.info("Application {} completed, purging application-level records", id); purgeRecordsAsync("/", id.toString(), PersistencePolicies.APPLICATION); }
operations.bind(path, written, 0); ZKPathDumper dump = registry.dumpPath(false); CuratorEventCatcher events = new CuratorEventCatcher();
/** * TODO: purge this once RM is doing the work * @throws IOException */ protected void setupInitialRegistryPaths() throws IOException { if (registryOperations instanceof RMRegistryOperationsService) { RMRegistryOperationsService rmRegOperations = (RMRegistryOperationsService) registryOperations; rmRegOperations.initUserRegistryAsync(service_user_name); } }
/** * Queue an async operation to purge all matching records under a base path. * <ol> * <li>Uses a depth first search</li> * <li>A match is on ID and persistence policy, or, if policy==-1, any match</li> * <li>If a record matches then it is deleted without any child searches</li> * <li>Deletions will be asynchronous if a callback is provided</li> * </ol> * @param path base path * @param id ID for service record.id * @param persistencePolicyMatch ID for the persistence policy to match: * no match, no delete. * @return a future that returns the #of records deleted */ @VisibleForTesting public Future<Integer> purgeRecordsAsync(String path, String id, String persistencePolicyMatch) { return purgeRecordsAsync(path, id, persistencePolicyMatch, purgeOnCompletionPolicy, new DeleteCompletionCallback()); }
operations.bind(dns2path, comp2, BindFlags.CREATE); ZKPathDumper pathDumper = registry.dumpPath(false); LOG.info(pathDumper.toString());
/** * TODO: purge this once RM is doing the work * @throws IOException */ protected void setupInitialRegistryPaths() throws IOException { if (registryOperations instanceof RMRegistryOperationsService) { RMRegistryOperationsService rmRegOperations = (RMRegistryOperationsService) registryOperations; rmRegOperations.initUserRegistryAsync(service_user_name); } }
InterruptedException { Future<Integer> future = registry.purgeRecordsAsync(path, id, policyMatch, purgePolicy, callback); try {
/** * This is the event where the user is known, so the user directory * can be created * @param applicationId application ID * @param user username * @throws IOException problems */ public void onStateStoreEvent(ApplicationId applicationId, String user) throws IOException { initUserRegistryAsync(user); }