Skip to content

Commit cb5a7f4

Browse files
committed
HADOOP-19278. Final pre-merge review
* yetus complaints * search source for "marker" and identify what needs to change (docs, some test comments and messages) * same for "keeping" Change-Id: I78988d33a15be2fbc48c7bc309391f8a7e52f63c
1 parent f250f4c commit cb5a7f4

File tree

15 files changed

+39
-126
lines changed

15 files changed

+39
-126
lines changed

hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/Constants.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -869,10 +869,13 @@ private Constants() {
869869
/**
870870
* Paths considered "authoritative".
871871
* When S3guard was supported, this skipped checks to s3 on directory listings.
872-
* It is also use to optionally disable marker retentation purely on these
873-
* paths -a feature which is still retained/available.
872+
* It was also possilbe to use to optionally disable marker retentation purely on these
873+
* paths -a feature which is no longer available.
874+
* As no feature uses this any more, it is declared as deprecated.
874875
* */
876+
@Deprecated
875877
public static final String AUTHORITATIVE_PATH = "fs.s3a.authoritative.path";
878+
@Deprecated
876879
public static final String[] DEFAULT_AUTHORITATIVE_PATH = {};
877880

878881
/**
@@ -1405,6 +1408,7 @@ private Constants() {
14051408
* Always false.
14061409
* Value: {@value}.
14071410
*/
1411+
@Deprecated
14081412
public static final String STORE_CAPABILITY_DIRECTORY_MARKER_POLICY_DELETE
14091413
= "fs.s3a.capability.directory.marker.policy.delete";
14101414

@@ -1414,6 +1418,7 @@ private Constants() {
14141418
* This probe always returns false.
14151419
* Value: {@value}.
14161420
*/
1421+
@Deprecated
14171422
public static final String
14181423
STORE_CAPABILITY_DIRECTORY_MARKER_POLICY_AUTHORITATIVE =
14191424
"fs.s3a.capability.directory.marker.policy.authoritative";

hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/impl/MkdirOperation.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,6 @@ S3AFileStatus probePathStatus(Path path,
262262
/**
263263
* Create a fake directory, always ending in "/".
264264
* Retry policy: retrying; translated.
265-
* the keepMarkers flag controls whether or not markers
266-
* are automatically kept (this is set when creating
267-
* directories under a magic path, always)
268265
* @param dir dir to create
269266
* @throws IOException IO failure
270267
*/

hadoop-tools/hadoop-aws/src/site/markdown/tools/hadoop-aws/assumed_roles.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,10 @@ views or operations.
295295
Particular troublespots are "directory markers" and
296296
failures of non-atomic operations, particularly `rename()` and `delete()`.
297297

298-
A directory marker such as `/users/` will not be deleted if the user `alice`
299-
creates a directory `/users/alice` *and* she only has access to `/users/alice`.
300-
301-
When a path or directory is deleted, the parent directory may not exist afterwards.
302-
In the example above, if `alice` deletes `/users/alice` and there are no
303-
other entries under `/users/alice`, then the directory marker `/users/` cannot
304-
be created. The directory `/users` will not exist in listings,
298+
If `alice` deletes `/users/alice` and there are no
299+
other entries under `/users/alice`, or a directory marker `/users` then that
300+
directory marker cannot be created.
301+
The directory `/users` will not exist in listings,
305302
`getFileStatus("/users")` or similar.
306303

307304
Rename will fail if it cannot delete the items it has just copied, that is

hadoop-tools/hadoop-aws/src/site/markdown/tools/hadoop-aws/directory_markers.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
limitations under the License. See accompanying LICENSE file.
1313
-->
1414

15-
# Controlling the S3A Directory Marker Behavior
15+
# S3A Directory Marker Behavior
1616

1717
This document discusses directory markers and a change to the S3A
1818
connector: surplus directory markers are no longer deleted.
@@ -21,7 +21,7 @@ This document shows how the performance of S3 I/O, especially applications
2121
creating many files (for example Apache Hive) or working with versioned S3 buckets can
2222
increase performance by changing the S3A directory marker retention policy.
2323

24-
This release always retains markers,
24+
This release always retains markers
2525
and _is potentially not backwards compatible_ with hadoop versions
2626
released before 2021.
2727

@@ -69,7 +69,7 @@ Everyone using these branches should upgrade to a supported version.
6969

7070
## History
7171

72-
### Hadoop 3.3.1 Directory marker retention is optional
72+
### Hadoop 3.3.1 Directory marker retention is optional
7373

7474
[HADOOP-13230](https://issues.apache.org/jira/browse/HADOOP-13230)
7575
_S3A to optionally retain directory markers_
@@ -84,7 +84,7 @@ Marker deletion can still be enabled.
8484

8585
Since this release there have been no reports of incompatibilities
8686
surfacing "in the wild". That is: out of date hadoop versions are not
87-
being used to work into the same parts of S3 buckets as modern releases.
87+
being used to work into the same parts of S3 buckets as modern releases.
8888

8989
### Hadoop 3.5: markers are never deleted
9090

hadoop-tools/hadoop-aws/src/site/markdown/tools/hadoop-aws/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323

2424
### <a name="directory-marker-compatibility"></a> Directory Marker Compatibility
2525

26-
This release does not delete directory markers when creating
26+
This release never delete directory markers when creating
2727
files or directories underneath.
2828
This is incompatible with versions of the Hadoop S3A client released
2929
before 2021.
3030

31-
Consult [Controlling the S3A Directory Marker Behavior](directory_markers.html) for
31+
Consult [S3A and Directory Markers](directory_markers.html) for
3232
full details.
3333

3434
## <a name="documents"></a> Documents
@@ -40,7 +40,7 @@ full details.
4040
* [Working with Third-party S3 Stores](./third_party_stores.html)
4141
* [Troubleshooting](./troubleshooting_s3a.html)
4242
* [Prefetching](./prefetching.html)
43-
* [Controlling the S3A Directory Marker Behavior](directory_markers.html).
43+
* [S3A and Directory Markers](directory_markers.html).
4444
* [Auditing](./auditing.html).
4545
* [Committing work to S3 with the "S3A Committers"](./committers.html)
4646
* [S3A Committers Architecture](./committer_architecture.html)

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AFileOperationCost.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@
4545

4646
/**
4747
* Use metrics to assert about the cost of file API calls.
48-
* Parameterized on directory marker keep vs delete.
49-
* When the FS is instantiated with creation performance, things
50-
* behave differently...its value is that of the marker keep flag,
51-
* so deletion costs are the same.
5248
*/
5349
public class ITestS3AFileOperationCost extends AbstractS3ACostTest {
5450

@@ -111,7 +107,7 @@ public void testCostOfListFilesOnFile() throws Throwable {
111107

112108
@Test
113109
public void testCostOfListFilesOnEmptyDir() throws Throwable {
114-
describe("Perpforming listFiles() on an empty dir with marker");
110+
describe("Performing listFiles() on an empty dir with marker");
115111
// this attem
116112
Path dir = path(getMethodName());
117113
S3AFileSystem fs = getFileSystem();

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/S3ATestConstants.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,6 @@ public interface S3ATestConstants {
246246
Duration TEST_SESSION_TOKEN_DURATION = Duration.ofSeconds(
247247
TEST_SESSION_TOKEN_DURATION_SECONDS);
248248

249-
/**
250-
* Test option to enable audits of the method path after
251-
* every test case.
252-
*/
253-
String DIRECTORY_MARKER_AUDIT = "fs.s3a.directory.marker.audit";
254-
255249
/**
256250
* Constant bytes being written when Client side encryption KMS is enabled
257251
* for a test. This bytes written takes into account "EncryptionContext",

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/S3ATestUtils.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,8 +1081,7 @@ public static List<Path> createDirsAndFiles(final FileSystem fs,
10811081
List<CompletableFuture<Path>> futures = new ArrayList<>(paths.size()
10821082
+ dirs.size());
10831083

1084-
// create directories. With dir marker retention, that adds more entries
1085-
// to cause deletion issues
1084+
// create directories.
10861085
try (DurationInfo ignore =
10871086
new DurationInfo(LOG, "Creating %d directories", dirs.size())) {
10881087
for (Path path : dirs) {

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/commit/ITestCommitOperationCost.java

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -112,37 +112,12 @@ protected String fileSystemIOStats() {
112112
return ioStatisticsToPrettyString(getFileSystem().getIOStatistics());
113113
}
114114

115-
@Test
116-
public void testMagicMkdir() throws Throwable {
117-
describe("Mkdirs 'MAGIC PATH' always skips dir marker deletion");
118-
S3AFileSystem fs = getFileSystem();
119-
Path baseDir = methodPath();
120-
// create dest dir marker, always
121-
fs.mkdirs(baseDir);
122-
Path magicDir = new Path(baseDir, MAGIC_PATH_PREFIX + JOB_ID);
123-
verifyMetrics(() -> {
124-
fs.mkdirs(magicDir);
125-
return fileSystemIOStats();
126-
},
127-
with(OBJECT_BULK_DELETE_REQUEST, 0),
128-
with(OBJECT_DELETE_REQUEST, 0),
129-
with(DIRECTORIES_CREATED, 1));
130-
verifyMetrics(() -> {
131-
fs.delete(magicDir, true);
132-
return fileSystemIOStats();
133-
},
134-
with(OBJECT_BULK_DELETE_REQUEST, 0),
135-
with(OBJECT_DELETE_REQUEST, 1),
136-
with(DIRECTORIES_CREATED, 0));
137-
assertPathExists("parent", baseDir);
138-
}
139-
140115
/**
141116
* When a magic subdir is deleted, parent dirs are not recreated.
142117
*/
143118
@Test
144119
public void testMagicMkdirs() throws Throwable {
145-
describe("Mkdirs __magic_job-<jobId>/subdir always skips dir marker deletion");
120+
describe("Mkdirs __magic_job-<jobId>/subdir always skips dir marker recreation");
146121
S3AFileSystem fs = getFileSystem();
147122
Path baseDir = methodPath();
148123
Path magicDir = new Path(baseDir, MAGIC_PATH_PREFIX + JOB_ID);
@@ -192,7 +167,7 @@ private void abortActiveStream() throws IOException {
192167

193168
@Test
194169
public void testCostOfCreatingMagicFile() throws Throwable {
195-
describe("Files created under magic paths skip existence checks and marker deletes");
170+
describe("Files created under magic paths skip existence checks");
196171
S3AFileSystem fs = getFileSystem();
197172
Path destFile = methodSubPath("file.txt");
198173
fs.delete(destFile.getParent(), true);
@@ -213,9 +188,8 @@ public void testCostOfCreatingMagicFile() throws Throwable {
213188

214189
stream.write("hello".getBytes(StandardCharsets.UTF_8));
215190

216-
// when closing, there will be no directories deleted
217-
// we do expect two PUT requests, because the marker and manifests
218-
// are both written
191+
// when closing, we expect two PUT requests,
192+
// because the marker and manifests are both written
219193
LOG.info("closing magic stream to {}", magicDest);
220194
verifyMetrics(() -> {
221195
stream.close();

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/performance/ITestDirectoryMarkerListing.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -402,10 +402,6 @@ public void testDelete() throws Throwable {
402402

403403
/**
404404
* Rename the base directory, expect the source files to move.
405-
* <p></p>
406-
* Whether or not the marker itself is copied depends on whether
407-
* the release's rename operation explicitly skips
408-
* markers on renames.
409405
*/
410406
@Test
411407
public void testRenameBase() throws Throwable {
@@ -433,14 +429,8 @@ public void testRenameBase() throws Throwable {
433429
assertIsFile(destMarkerPeer);
434430
head(destFileKeyUnderMarker);
435431

436-
// probe for the marker based on expected rename
437-
// behavior
438-
if (RENAME_COPIES_MARKERS) {
439-
head(destMarkerKeySlash);
440-
} else {
441-
head404(destMarkerKeySlash);
442-
}
443-
432+
// rename doesn't copy non-leaf markers
433+
head404(destMarkerKeySlash);
444434
}
445435

446436
/**

0 commit comments

Comments
 (0)