Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5c595c8
HADOOP-15619. Bucket info to add more on authoritative mode
steveloughran Nov 6, 2019
0d8b221
HADOOP-16684. tweak TTL entry
steveloughran Nov 6, 2019
42b066a
HADOOP-16664 address checkstyle where appropriate
steveloughran Nov 8, 2019
c21da7e
HADOOP-16697. Tune/audit auth mode
steveloughran Nov 8, 2019
749b763
HADOOP-16697 tune authoritative.
steveloughran Nov 15, 2019
1cab965
HADOOP-16697 prune and rename get authoritative "right"
steveloughran Nov 15, 2019
f75c27c
HADOOP-16697: test for ListLocatedStatus shows it doesn't mark as auth
steveloughran Nov 18, 2019
8d806e0
HADOOP-16697. S3Guard Import to add a -auth command
steveloughran Nov 18, 2019
95ec47a
HADOOP-16697 Auth mode: imports
steveloughran Nov 19, 2019
b06f806
HADOOP-16697 Auth mode: scan parents before PUTting updates
steveloughran Nov 19, 2019
f1cf96e
HADOOP-16697 Auth mode
steveloughran Nov 20, 2019
d728f76
HADOOP-16697 tuning import command
steveloughran Nov 20, 2019
f043b59
HADOOP-16697 rename auth mode test as it is DDB only
steveloughran Nov 21, 2019
85c02c8
HADOOP-16697 auth mode and empty dirs; pruning tuning
steveloughran Nov 22, 2019
a0f5a3c
HADOOP-16697 format exception text in rename test failure better
steveloughran Nov 25, 2019
ec36c8f
HADOOP-16725 s3guard prune can delete directories -leaving orphan chi…
steveloughran Nov 25, 2019
a9dd68b
HADOOP-16697 Authoritative mode and prune
steveloughran Nov 27, 2019
cf10674
HADOOP-16697 preparing for review.
steveloughran Dec 4, 2019
e3c071c
HADOOP-16697 findbugs to STFU
steveloughran Dec 5, 2019
aa3b8d8
HADOOP-16697 address Gabor's feedback on javadocs, comments & nits.
steveloughran Dec 5, 2019
3e2f1b6
HADOOP-16697. Checkstyle & a method rename suggested by Gabor
steveloughran Dec 10, 2019
a1449c5
HADOOP-16697. better logging of import
steveloughran Jan 2, 2020
8d19b41
Improve the s3guard authoritative tool based on use against an incons…
steveloughran Jan 3, 2020
f6e0779
HADOOP-16697 auth mode
steveloughran Jan 3, 2020
28b1692
HADOOP-16697 review recent docs and tweak
steveloughran Jan 6, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,10 @@ public void testRenameWithNonEmptySubDir() throws Throwable {
assertPathExists("not created in src/sub dir",
new Path(srcSubDir, "subfile.txt"));

fs.rename(srcDir, finalDir);
boolean rename = fs.rename(srcDir, finalDir);
assertTrue("rename(" + srcDir + ", " + finalDir + ") failed",
rename);

// Accept both POSIX rename behavior and CLI rename behavior
if (renameRemoveEmptyDest) {
// POSIX rename behavior
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ public static void nameTestThread() {
Thread.currentThread().setName("JUnit");
}

@Before
public void nameThread() {
Thread.currentThread().setName("JUnit-" + getMethodName());
}

protected String getMethodName() {
return methodName.getMethodName();
}

/**
* This must be implemented by all instantiated test cases.
* -provide the FS contract
Expand Down Expand Up @@ -172,6 +181,7 @@ protected int getTestTimeoutMillis() {
*/
@Before
public void setup() throws Exception {
Thread.currentThread().setName("setup");
LOG.debug("== Setup ==");
contract = createContract(createConfiguration());
contract.init();
Expand Down Expand Up @@ -200,6 +210,7 @@ public void setup() throws Exception {
*/
@After
public void teardown() throws Exception {
Thread.currentThread().setName("teardown");
LOG.debug("== Teardown ==");
deleteTestDirInTeardown();
LOG.debug("== Teardown complete ==");
Expand Down
5 changes: 5 additions & 0 deletions hadoop-tools/hadoop-aws/dev-support/findbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,10 @@
<Method name="openFileWithOptions"/>
<Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE"/>
</Match>
<Match>
<Class name="org.apache.hadoop.fs.s3a.s3guard.S3GuardTool$BucketInfo"/>
<Method name="run"/>
<Bug pattern="SF_SWITCH_FALLTHROUGH"/>
</Match>

</FindBugsFilter>
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,14 @@ public String getVersionId() {
return versionId;
}

/**
* set the S3 object versionId, else null.
* @param versionId version ID or null.
*/
public void setVersionId(final String versionId) {
this.versionId = versionId;
}

/** Compare if this object is equal to another object.
* @param o the object to be compared.
* @return true if two file status has the same path name; false if not.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1222,7 +1222,8 @@ public boolean rename(Path src, Path dst) throws IOException {
} catch (AmazonClientException e) {
throw translateException("rename(" + src +", " + dst + ")", src, e);
} catch (RenameFailedException e) {
LOG.debug(e.getMessage());
LOG.info("{}", e.getMessage());
LOG.debug("rename failure", e);
return e.getExitCode();
} catch (FileNotFoundException e) {
LOG.debug(e.toString());
Expand Down Expand Up @@ -2454,7 +2455,7 @@ public FileStatus[] innerListStatus(Path f) throws FileNotFoundException,
* @param path path
* @return true if the path is auth
*/
protected boolean allowAuthoritative(final Path path) {
public boolean allowAuthoritative(final Path path) {
return S3Guard.allowAuthoritative(path, this,
allowAuthoritativeMetadataStore, allowAuthoritativePaths);
}
Expand Down Expand Up @@ -2697,7 +2698,7 @@ S3AFileStatus innerGetFileStatus(final Path f,
+ " s3modtime={}; msModTime={} updating metastore",
path, s3ModTime, msModTime);
return S3Guard.putAndReturn(metadataStore, s3AFileStatus,
instrumentation, ttlTimeProvider);
ttlTimeProvider);
}
}
}
Expand Down Expand Up @@ -2732,13 +2733,12 @@ S3AFileStatus innerGetFileStatus(final Path f,
}
// entry was found, save in S3Guard
return S3Guard.putAndReturn(metadataStore, s3FileStatus,
instrumentation, ttlTimeProvider);
ttlTimeProvider);
} else {
// there was no entry in S3Guard
// retrieve the data and update the metadata store in the process.
return S3Guard.putAndReturn(metadataStore,
s3GetFileStatus(path, key, probes, tombstones),
instrumentation,
ttlTimeProvider);
}
}
Expand Down Expand Up @@ -3154,12 +3154,12 @@ protected synchronized void stopAllServices() {
HadoopExecutors.shutdown(unboundedThreadPool, LOG,
THREAD_POOL_SHUTDOWN_DELAY_SECONDS, TimeUnit.SECONDS);
unboundedThreadPool = null;
closeAutocloseables(LOG, credentials);
cleanupWithLogger(LOG,
metadataStore,
instrumentation,
delegationTokens.orElse(null),
signerManager);
closeAutocloseables(LOG, credentials);
delegationTokens = Optional.empty();
signerManager = null;
credentials = null;
Expand Down Expand Up @@ -3506,13 +3506,21 @@ void finishedWrite(String key, long length, String eTag, String versionId,
activeState = stateToClose;
}
S3Guard.addAncestors(metadataStore, p, ttlTimeProvider, activeState);
final boolean isDir = objectRepresentsDirectory(key, length);
S3AFileStatus status = createUploadFileStatus(p,
S3AUtils.objectRepresentsDirectory(key, length), length,
isDir, length,
getDefaultBlockSize(p), username, eTag, versionId);
S3Guard.putAndReturn(metadataStore, status,
instrumentation,
ttlTimeProvider,
activeState);
if (!isDir) {
S3Guard.putAndReturn(metadataStore, status,
ttlTimeProvider,
activeState);
} else {
// this is a directory marker so put it as such.
status.setIsEmptyDirectory(Tristate.TRUE);
S3Guard.putAuthDirectoryMarker(metadataStore, status,
ttlTimeProvider,
activeState);
}
}
} catch (IOException e) {
if (failOnMetadataWriteError) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.fs.FileSystem.Statistics;
import org.apache.hadoop.fs.s3a.s3guard.MetastoreInstrumentation;
import org.apache.hadoop.metrics2.AbstractMetric;
import org.apache.hadoop.metrics2.MetricStringBuilder;
import org.apache.hadoop.metrics2.MetricsCollector;
Expand Down Expand Up @@ -188,6 +189,7 @@ public class S3AInstrumentation implements Closeable, MetricsSource {
S3GUARD_METADATASTORE_RECORD_WRITES,
S3GUARD_METADATASTORE_RETRY,
S3GUARD_METADATASTORE_THROTTLED,
S3GUARD_METADATASTORE_AUTHORITATIVE_DIRECTORIES_UPDATED,
STORE_IO_THROTTLED,
DELEGATION_TOKENS_ISSUED,
FILES_DELETE_REJECTED
Expand Down Expand Up @@ -562,11 +564,11 @@ public InputStreamStatistics newInputStreamStatistics() {
}

/**
* Create a S3Guard instrumentation instance.
* Create a MetastoreInstrumentation instrumentation instance.
* There's likely to be at most one instance of this per FS instance.
* @return the S3Guard instrumentation point.
*/
public S3GuardInstrumentation getS3GuardInstrumentation() {
public MetastoreInstrumentation getS3GuardInstrumentation() {
return s3GuardInstrumentation;
}

Expand Down Expand Up @@ -1127,43 +1129,35 @@ public String toString() {
/**
* Instrumentation exported to S3Guard.
*/
public final class S3GuardInstrumentation {
private final class S3GuardInstrumentation
implements MetastoreInstrumentation {

/** Initialized event. */
@Override
public void initialized() {
incrementCounter(S3GUARD_METADATASTORE_INITIALIZATION, 1);
}

@Override
public void storeClosed() {

}

/**
* Throttled request.
*/
@Override
public void throttled() {
// counters are incremented by owner.
}

/**
* S3Guard is retrying after a (retryable) failure.
*/
@Override
public void retrying() {
// counters are incremented by owner.
}

/**
* Records have been read.
* @param count the number of records read
*/
@Override
public void recordsDeleted(int count) {
incrementCounter(S3GUARD_METADATASTORE_RECORD_DELETES, count);
}

/**
* Records have been read.
* @param count the number of records read
*/
@Override
public void recordsRead(int count) {
incrementCounter(S3GUARD_METADATASTORE_RECORD_READS, count);
}
Expand All @@ -1172,10 +1166,25 @@ public void recordsRead(int count) {
* records have been written (including deleted).
* @param count number of records written.
*/
@Override
public void recordsWritten(int count) {
incrementCounter(S3GUARD_METADATASTORE_RECORD_WRITES, count);
}

@Override
public void directoryMarkedAuthoritative() {
incrementCounter(S3GUARD_METADATASTORE_AUTHORITATIVE_DIRECTORIES_UPDATED,
1);
}

@Override
public void entryAdded(final long durationNanos) {
addValueToQuantiles(
S3GUARD_METADATASTORE_PUT_PATH_LATENCY,
durationNanos);
incrementCounter(S3GUARD_METADATASTORE_PUT_PATH_REQUEST, 1);
}

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ public enum Statistic {
S3GUARD_METADATASTORE_THROTTLE_RATE(
"s3guard_metadatastore_throttle_rate",
"S3Guard metadata store throttle rate"),
S3GUARD_METADATASTORE_AUTHORITATIVE_DIRECTORIES_UPDATED(
"s3guard_metadatastore_authoritative_directories_updated",
"S3Guard metadata store authoritative directories updated from S3"),

STORE_IO_THROTTLED("store_io_throttled", "Requests throttled and retried"),

Expand Down
Loading