/** * Adds a directive, skipping most error checking. This should only be called * internally in special scenarios like edit log replay. */ CacheDirectiveInfo addDirectiveFromEditLog(CacheDirectiveInfo directive) throws InvalidRequestException { long id = directive.getId(); CacheDirective entry = new CacheDirective(directive); CachePool pool = cachePools.get(directive.getPool()); addInternal(entry, pool); if (nextDirectiveId <= id) { nextDirectiveId = id + 1; } return entry.toInfo(); }
public CacheDirectiveInfo addDirective( CacheDirectiveInfo info, FSPermissionChecker pc, EnumSet<CacheFlag> flags) throws IOException { assert namesystem.hasWriteLock(); CacheDirective directive; try { CachePool pool = getCachePool(validatePoolName(info)); checkWritePermission(pc, pool); String path = validatePath(info); short replication = validateReplication( info, pool.getDefaultReplication()); long expiryTime = validateExpiryTime(info, pool.getMaxRelativeExpiryMs()); // Do quota validation if required if (!flags.contains(CacheFlag.FORCE)) { checkLimit(pool, path, replication); } // All validation passed // Add a new entry with the next available ID. long id = getNextDirectiveId(); directive = new CacheDirective(id, path, replication, expiryTime); addInternal(directive, pool); } catch (IOException e) { LOG.warn("addDirective of " + info + " failed: ", e); throw e; } LOG.info("addDirective of {} successful.", info); return directive.toInfo(); }
/** * Modifies a directive, skipping most error checking. This is for careful * internal use only. modifyDirective can be non-deterministic since its error * checking depends on current system time, which poses a problem for edit log * replay. */ void modifyDirectiveFromEditLog(CacheDirectiveInfo info) throws InvalidRequestException { // Check for invalid IDs. Long id = info.getId(); if (id == null) { throw new InvalidRequestException("Must supply an ID."); } CacheDirective prevEntry = getById(id); CacheDirectiveInfo newInfo = createFromInfoAndDefaults(info, prevEntry); removeInternal(prevEntry); addInternal(new CacheDirective(newInfo), getCachePool(newInfo.getPool())); }
addInternal(new CacheDirective(builder.build()), destPool); } catch (IOException e) { LOG.warn("modifyDirective of " + idString + " failed: ", e);
/** * Adds a directive, skipping most error checking. This should only be called * internally in special scenarios like edit log replay. */ CacheDirectiveInfo addDirectiveFromEditLog(CacheDirectiveInfo directive) throws InvalidRequestException { long id = directive.getId(); CacheDirective entry = new CacheDirective(directive); CachePool pool = cachePools.get(directive.getPool()); addInternal(entry, pool); if (nextDirectiveId <= id) { nextDirectiveId = id + 1; } return entry.toInfo(); }
/** * Adds a directive, skipping most error checking. This should only be called * internally in special scenarios like edit log replay. */ CacheDirectiveInfo addDirectiveFromEditLog(CacheDirectiveInfo directive) throws InvalidRequestException { long id = directive.getId(); CacheDirective entry = new CacheDirective(directive); CachePool pool = cachePools.get(directive.getPool()); addInternal(entry, pool); if (nextDirectiveId <= id) { nextDirectiveId = id + 1; } return entry.toInfo(); }
public CacheDirectiveInfo addDirective( CacheDirectiveInfo info, FSPermissionChecker pc, EnumSet<CacheFlag> flags) throws IOException { assert namesystem.hasWriteLock(); CacheDirective directive; try { CachePool pool = getCachePool(validatePoolName(info)); checkWritePermission(pc, pool); String path = validatePath(info); short replication = validateReplication(info, (short)1); long expiryTime = validateExpiryTime(info, pool.getMaxRelativeExpiryMs()); // Do quota validation if required if (!flags.contains(CacheFlag.FORCE)) { checkLimit(pool, path, replication); } // All validation passed // Add a new entry with the next available ID. long id = getNextDirectiveId(); directive = new CacheDirective(id, path, replication, expiryTime); addInternal(directive, pool); } catch (IOException e) { LOG.warn("addDirective of " + info + " failed: ", e); throw e; } LOG.info("addDirective of {} successful.", info); return directive.toInfo(); }
/** * Modifies a directive, skipping most error checking. This is for careful * internal use only. modifyDirective can be non-deterministic since its error * checking depends on current system time, which poses a problem for edit log * replay. */ void modifyDirectiveFromEditLog(CacheDirectiveInfo info) throws InvalidRequestException { // Check for invalid IDs. Long id = info.getId(); if (id == null) { throw new InvalidRequestException("Must supply an ID."); } CacheDirective prevEntry = getById(id); CacheDirectiveInfo newInfo = createFromInfoAndDefaults(info, prevEntry); removeInternal(prevEntry); addInternal(new CacheDirective(newInfo), getCachePool(newInfo.getPool())); }
/** * Modifies a directive, skipping most error checking. This is for careful * internal use only. modifyDirective can be non-deterministic since its error * checking depends on current system time, which poses a problem for edit log * replay. */ void modifyDirectiveFromEditLog(CacheDirectiveInfo info) throws InvalidRequestException { // Check for invalid IDs. Long id = info.getId(); if (id == null) { throw new InvalidRequestException("Must supply an ID."); } CacheDirective prevEntry = getById(id); CacheDirectiveInfo newInfo = createFromInfoAndDefaults(info, prevEntry); removeInternal(prevEntry); addInternal(new CacheDirective(newInfo), getCachePool(newInfo.getPool())); }
addInternal(new CacheDirective(builder.build()), destPool); } catch (IOException e) { LOG.warn("modifyDirective of " + idString + " failed: ", e);
public CacheDirectiveInfo addDirective( CacheDirectiveInfo info, FSPermissionChecker pc, EnumSet<CacheFlag> flags) throws IOException { assert namesystem.hasWriteLock(); CacheDirective directive; try { CachePool pool = getCachePool(validatePoolName(info)); checkWritePermission(pc, pool); String path = validatePath(info); short replication = validateReplication(info, (short)1); long expiryTime = validateExpiryTime(info, pool.getMaxRelativeExpiryMs()); // Do quota validation if required if (!flags.contains(CacheFlag.FORCE)) { checkLimit(pool, path, replication); } // All validation passed // Add a new entry with the next available ID. long id = getNextDirectiveId(); directive = new CacheDirective(id, path, replication, expiryTime); addInternal(directive, pool); } catch (IOException e) { LOG.warn("addDirective of " + info + " failed: ", e); throw e; } LOG.info("addDirective of {} successful.", info); return directive.toInfo(); }
addInternal(new CacheDirective(builder.build()), destPool); } catch (IOException e) { LOG.warn("modifyDirective of " + idString + " failed: ", e);