/** * Upgrades the generation stamp for the filesystem * by reserving a sufficient range for all existing blocks. * Should be invoked only during the first upgrade to * sequential block IDs. */ public long upgradeLegacyGenerationStamp() { Preconditions.checkState(generationStamp.getCurrentValue() == GenerationStamp.LAST_RESERVED_STAMP); generationStamp.skipTo(legacyGenerationStamp.getCurrentValue() + HdfsServerConstants.RESERVED_LEGACY_GENERATION_STAMPS); legacyGenerationStampLimit = generationStamp.getCurrentValue(); return generationStamp.getCurrentValue(); }
@VisibleForTesting long getNextGenerationStamp() { return generationStamp.nextValue(); }
/** * Sets the current generation stamp for legacy blocks */ public void setLegacyGenerationStamp(long stamp) { legacyGenerationStamp.setCurrentValue(stamp); }
/** * Gets the current generation stamp for legacy blocks */ public long getLegacyGenerationStamp() { return legacyGenerationStamp.getCurrentValue(); }
/** {@inheritDoc} */ public int compareTo(GenerationStamp that) { return compare(this.genstamp, that.genstamp); }
/** * Increments, logs and then returns the stamp */ private long nextGenerationStamp() { long gs = generationStamp.nextStamp(); getEditLog().logGenerationStamp(gs); return gs; }
/** {@inheritDoc} */ public boolean equals(Object o) { if (!(o instanceof Block)) { return false; } final Block that = (Block)o; //Wildcard generationStamp is ALLOWED here return this.blockId == that.blockId && GenerationStamp.equalsWithWildcard( this.generationStamp, that.generationStamp); }
/** * Sets the generation stamp for this filesystem */ public void setGenerationStamp(long stamp) { generationStamp.setStamp(stamp); }
/** * Gets the generation stamp for this filesystem */ public long getGenerationStamp() { return generationStamp.getStamp(); }
public Writable newInstance() { return new GenerationStamp(0); } });
public long getGenerationStamp() { return generationStamp.getCurrentValue(); }
/** {@inheritDoc} */ public int compareTo(GenerationStamp that) { return compare(this.genstamp, that.genstamp); }
/** * Increments, logs and then returns the stamp */ long nextGenerationStamp() { long gs = generationStamp.nextStamp(); getEditLog().logGenerationStamp(gs); return gs; }
/** {@inheritDoc} */ public boolean equals(Object o) { if (!(o instanceof Block)) { return false; } final Block that = (Block)o; //Wildcard generationStamp is ALLOWED here return this.blockId == that.blockId && GenerationStamp.equalsWithWildcard( this.generationStamp, that.generationStamp); }
/** * Sets the generation stamp for this filesystem */ public void setGenerationStamp(long stamp) { generationStamp.setStamp(stamp); }
/** * Gets the generation stamp for this filesystem */ public long getGenerationStamp() { return generationStamp.getStamp(); }
public Writable newInstance() { return new GenerationStamp(0); } });
/** * Upgrades the generation stamp for the filesystem * by reserving a sufficient range for all existing blocks. * Should be invoked only during the first upgrade to * sequential block IDs. */ public long upgradeGenerationStampToV2() { Preconditions.checkState(generationStampV2.getCurrentValue() == GenerationStamp.LAST_RESERVED_STAMP); generationStampV2.skipTo(generationStampV1.getCurrentValue() + HdfsConstants.RESERVED_GENERATION_STAMPS_V1); generationStampV1Limit = generationStampV2.getCurrentValue(); return generationStampV2.getCurrentValue(); }
/** * Gets the current generation stamp for this filesystem */ public void setGenerationStamp(long stamp) { generationStamp.setCurrentValue(stamp); }
@VisibleForTesting long getNextLegacyGenerationStamp() throws IOException { long legacyGenStamp = legacyGenerationStamp.nextValue(); if (legacyGenStamp >= legacyGenerationStampLimit) { // We ran out of generation stamps for legacy blocks. In practice, it // is extremely unlikely as we reserved 1T legacy generation stamps. The // result is that we can no longer append to the legacy blocks that // were created before the upgrade to sequential block IDs. throw new OutOfLegacyGenerationStampsException(); } return legacyGenStamp; }