HDFS-9132. Pass genstamp to ReplicaAccessorBuilder. (Colin Patrick McCabe via Lei (Eddy) Xu)
This commit is contained in:
parent
a6166aa552
commit
1a2870f6ff
|
@ -36,6 +36,9 @@ public abstract class ReplicaAccessorBuilder {
|
||||||
public abstract ReplicaAccessorBuilder
|
public abstract ReplicaAccessorBuilder
|
||||||
setBlock(long blockId, String blockPoolId);
|
setBlock(long blockId, String blockPoolId);
|
||||||
|
|
||||||
|
/** Set the genstamp of the block which is being opened. */
|
||||||
|
public abstract ReplicaAccessorBuilder setGenerationStamp(long genstamp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set whether checksums must be verified. Checksums should be skipped if
|
* Set whether checksums must be verified. Checksums should be skipped if
|
||||||
* the user has disabled checksum verification in the configuration. Users
|
* the user has disabled checksum verification in the configuration. Users
|
||||||
|
|
|
@ -620,6 +620,9 @@ Release 2.8.0 - UNRELEASED
|
||||||
HDFS-9112. Improve error message for Haadmin when multiple name service IDs
|
HDFS-9112. Improve error message for Haadmin when multiple name service IDs
|
||||||
are configured. (Anu Engineer via jing9)
|
are configured. (Anu Engineer via jing9)
|
||||||
|
|
||||||
|
HDFS-9132. Pass genstamp to ReplicaAccessorBuilder. (Colin Patrick McCabe via
|
||||||
|
Lei (Eddy) Xu)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than
|
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than
|
||||||
|
|
|
@ -383,6 +383,7 @@ public class BlockReaderFactory implements ShortCircuitReplicaCreator {
|
||||||
ReplicaAccessor accessor = builder.
|
ReplicaAccessor accessor = builder.
|
||||||
setAllowShortCircuitReads(allowShortCircuitLocalReads).
|
setAllowShortCircuitReads(allowShortCircuitLocalReads).
|
||||||
setBlock(block.getBlockId(), block.getBlockPoolId()).
|
setBlock(block.getBlockId(), block.getBlockPoolId()).
|
||||||
|
setGenerationStamp(block.getGenerationStamp()).
|
||||||
setBlockAccessToken(tokenBytes).
|
setBlockAccessToken(tokenBytes).
|
||||||
setClientName(clientName).
|
setClientName(clientName).
|
||||||
setConfiguration(configuration).
|
setConfiguration(configuration).
|
||||||
|
|
|
@ -81,6 +81,7 @@ public class TestExternalBlockReader {
|
||||||
String fileName;
|
String fileName;
|
||||||
long blockId;
|
long blockId;
|
||||||
String blockPoolId;
|
String blockPoolId;
|
||||||
|
long genstamp;
|
||||||
boolean verifyChecksum;
|
boolean verifyChecksum;
|
||||||
String clientName;
|
String clientName;
|
||||||
boolean allowShortCircuit;
|
boolean allowShortCircuit;
|
||||||
|
@ -100,6 +101,12 @@ public class TestExternalBlockReader {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ReplicaAccessorBuilder setGenerationStamp(long genstamp) {
|
||||||
|
this.genstamp = genstamp;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ReplicaAccessorBuilder setVerifyChecksum(boolean verifyChecksum) {
|
public ReplicaAccessorBuilder setVerifyChecksum(boolean verifyChecksum) {
|
||||||
this.verifyChecksum = verifyChecksum;
|
this.verifyChecksum = verifyChecksum;
|
||||||
|
@ -154,12 +161,14 @@ public class TestExternalBlockReader {
|
||||||
int numCloses = 0;
|
int numCloses = 0;
|
||||||
String error = "";
|
String error = "";
|
||||||
String prefix = "";
|
String prefix = "";
|
||||||
|
final long genstamp;
|
||||||
|
|
||||||
SyntheticReplicaAccessor(SyntheticReplicaAccessorBuilder builder) {
|
SyntheticReplicaAccessor(SyntheticReplicaAccessorBuilder builder) {
|
||||||
this.length = builder.visibleLength;
|
this.length = builder.visibleLength;
|
||||||
this.contents = DFSTestUtil.
|
this.contents = DFSTestUtil.
|
||||||
calculateFileContentsFromSeed(SEED, Ints.checkedCast(length));
|
calculateFileContentsFromSeed(SEED, Ints.checkedCast(length));
|
||||||
this.builder = builder;
|
this.builder = builder;
|
||||||
|
this.genstamp = builder.genstamp;
|
||||||
String uuid = this.builder.conf.
|
String uuid = this.builder.conf.
|
||||||
get(SYNTHETIC_BLOCK_READER_TEST_UUID_KEY);
|
get(SYNTHETIC_BLOCK_READER_TEST_UUID_KEY);
|
||||||
LinkedList<SyntheticReplicaAccessor> accessorsList =
|
LinkedList<SyntheticReplicaAccessor> accessorsList =
|
||||||
|
@ -235,6 +244,10 @@ public class TestExternalBlockReader {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long getGenerationStamp() {
|
||||||
|
return genstamp;
|
||||||
|
}
|
||||||
|
|
||||||
synchronized void addError(String text) {
|
synchronized void addError(String text) {
|
||||||
LOG.error("SyntheticReplicaAccessor error: " + text);
|
LOG.error("SyntheticReplicaAccessor error: " + text);
|
||||||
error = error + prefix + text;
|
error = error + prefix + text;
|
||||||
|
@ -284,6 +297,8 @@ public class TestExternalBlockReader {
|
||||||
Assert.assertEquals(dfs.getClient().clientName,
|
Assert.assertEquals(dfs.getClient().clientName,
|
||||||
accessor.builder.clientName);
|
accessor.builder.clientName);
|
||||||
Assert.assertEquals("/a", accessor.builder.fileName);
|
Assert.assertEquals("/a", accessor.builder.fileName);
|
||||||
|
Assert.assertEquals(block.getGenerationStamp(),
|
||||||
|
accessor.getGenerationStamp());
|
||||||
Assert.assertTrue(accessor.builder.verifyChecksum);
|
Assert.assertTrue(accessor.builder.verifyChecksum);
|
||||||
Assert.assertEquals(1024L, accessor.builder.visibleLength);
|
Assert.assertEquals(1024L, accessor.builder.visibleLength);
|
||||||
Assert.assertEquals(1024L, accessor.totalRead);
|
Assert.assertEquals(1024L, accessor.totalRead);
|
||||||
|
|
Loading…
Reference in New Issue