Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDDS-4557. [DESIGN] S3/Ozone Filesystem inter-op #1411

Closed
wants to merge 12 commits into from
154 changes: 113 additions & 41 deletions hadoop-hdds/docs/content/design/s3_hcfs.md
Expand Up @@ -20,7 +20,6 @@ author: Marton Elek,
limitations under the License. See accompanying LICENSE file.
-->


# Ozone S3 vs file-system semantics

Ozone is an object-store for Hadoop ecosystem which can be used from multiple interfaces:
Expand All @@ -40,14 +39,14 @@ There are multiple challenges when file system hierarchy is simulated by a flat

See also the [Hadoop S3A documentation](https://hadoop.apache.org/docs/current/hadoop-aws/tools/hadoop-aws/index.html#Introducing_the_Hadoop_S3A_client) which describes some of these problem when AWS S3 is used. (*Warnings* section)

## Current status
# Current status

As of today *Ozone Manager* has two different interfaces (both are defined in `OmClientProtocol.proto`):

1. object store related functions (like *CreateKey*, *LookupKey*, *DeleteKey*,...)
2. file system related functions (like *CreateFile*, *LookupFile*,...)

File system related functions uses the same flat hierarchy under the hood but includes additional functionality. For example the `createFile` call creates all the intermediate directories for a specific key (create file `/a/b/c` will create `/a/b` and `/a` entries in the key space)
File system related functions uses the same flat hierarchy under the hood but includes additional functionalities. For example the `createFile` call creates all the intermediate directories for a specific key (create file `/a/b/c` will create `/a/b` and `/a` entries in the key space)

Today, if a key is created from the S3 interface can cause exceptions if the intermediate directories are checked from HCFS:

Expand All @@ -67,45 +66,100 @@ To solve the performance problems of the directory listing / rename, [HDDS-2939]

[HDDS-4097](https://issues.apache.org/jira/browse/HDDS-4097) is created to normalize the key names based on file-system semantics if `ozone.om.enable.filesystem.paths` is enabled. But please note that `ozone.om.enable.filesystem.paths` should always be turned on if S3 and HCFS are both used which means that S3 and HCFS couldn't be used together with normalization.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S3 and HCFS couldn't be used together without normalization??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thanks. I also clarified this paragraph a little:

But please note that ozone.om.enable.filesystem.paths should always be turned on if S3 and HCFS are both used. It means that if both S3 and HCFS are used, normalization is forced, and S3 interface is not fully AWS S3 compatible. There is no option to use HCFS and S3 but with full AWS compatibility (and reduced HCFS compatibility).


## Goals
# Goals

* Out of the box Ozone should support both S3 and HCFS interfaces without any settings. (It's possible only for the regular, fs compatible key names)
* As 100% compatibility couldn't be achieved on both side we need a configuration to set the expectations for incompatible key names
* Default behavior of `o3fs` and `ofs` should be as close to `s3a` as possible (when s3 compatibilty is prefered)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tradeoff here is that in this mode the FS integrity can be affected by putting invalid keys via S3. E.g. i could put key names which have elements like . and .., or key names which try to escape the root of the filesystem. I think the tradeoffs should be called out else this doc is not representing the options correctly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks the suggestion. I added a few more sentences to make it more clear. See: bd7792f commit (or the rendered view).


# Possible cases to support

There are two main aspects of supporting both `ofs/o3fs` and `s3` together:

1. `ofs/o3fs` require to create intermediate directory entries (for exapmle `/a/b` for the key `/b/c/c`)
elek marked this conversation as resolved.
Show resolved Hide resolved
2. Special file-system incompatible key names require special attention

The second couldn't be done with compromise.

1. We either support all key names (including non fs compatible key names), which means `ofs/o3fs` can provide only a partial view
2. Or we can normalize the key names to be fs compatible (which makes it possible to create inconsistent S3 keys)

HDDS-3955 introduced `ozone.om.enable.filesystem.paths`, with this setting we will have two possible usage pattern:

| ozone.om.enable.filesystem.paths= | true | false
|-|-|-|
| create itermediate dirs | YES | NO |
| normalize key names from `ofs/o3fs` | YES | NO
| force to normalize key names of `s3` interface | YES (1) | NO
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no such force flag, if normalize is enable, we normalize from all interfaces.
As We have 4 interfaces.

  1. CLI
  2. S3
  3. HCFS
  4. Java Native Client.

So, this flag is not some thing special for S3.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, agree. I tried to explain this behavior with the two lines to show that both are normalized. This is not because we have two flags.

| `s3` key `/a/b/c` available from `ofs/o3fs` | YES | NO
| `s3` key `/a/b//c` available from `ofs/o3fs` | YES | NO
| `s3` key `/a/b//c` available from `s3` | AWS S3 incompatibility | YES
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any pointer to S3 compatibility requirement? e.g., path handling, normalization, etc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, AWS S3 can save any key without normalization, and the same content can be retrieved with the same key (and list shows the raw names).

AWS S3 incompatibility: means partial incompatibility. All the s3 tools which depends on the original AWS S3 behavior can be failed. (For example if a S3 Fuse file system creates dirs with keys ending with / AND store real directory metadata on that specific key --> it will be broken).

I started to create robot tests for these cases which can be used to check this side of the compatibility:

elek@d21890b


(1): Under implementation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that is true. Paths are normalized already on the S3 interface when writing new keys.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here AWS S3 incompatibility means, is it because we are showing normalized keys?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here AWS S3 incompatibility means, is it because we are showing normalized keys?

Yes, keys are normalized. Content can be found under different key names.

I started to define the 100% compatibility here:

https://github.com/elek/hadoop-ozone/blob/s3-compat/hadoop-ozone/dist/src/main/smoketest/s3/s3-vs-filepath.robot

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that is true. Paths are normalized already on the S3 interface when writing new keys.

But not for read, if I understood well. But happy to remove this line if it's confusing.


* Out of the box Ozone should support both S3 and HCFS interfaces without any settings. (It's possible only for the regular path)
* As 100% compatibility couldn't be achieved on both side we need a configuration to set the expectations in case of incompatible key names
* Default behavior of `o3fs` and `ofs` should be as close to `s3a` as possible
This proposal suggest to use a 3rd option where 100% AWS compatiblity is guaranteed in exchange of a limited `ofs/o3fs` view:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I completely disagree with this trade-off. The FS limited view is neither here nor there. You can insert keys via the S3 interface that are not visible via the FS view at all. To me this is the same as a corrupted filesystem. Marton, I liked your offline suggestion much better - disable FS access completely when operating in S3-compatible mode.

Taking this one step further, I have a different approach in mind. Let's make this a per-bucket setting. For buckets created via the S3 interface, by default the S3 semantics will be preserved 100% unless the global setting is enabled and FS access will not be allowed at all. For buckets created via FS interface, the FS semantics will always take precedence. If the global setting is enabled, then the value of the setting at the time of bucket creation is sampled and that takes effect for the lifetime of the bucket. Basically you can't change the behavior for a given bucket.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also have another way right, an existing bucket can be exposed created via CLI to be exposed to S3, what semantics that bucket will get?

For buckets created via FS interface, the FS semantics will always take precedence

Buckets creation is possible via only OFS, what about O3fs?

If the global setting is enabled, then the value of the setting at the time of bucket creation is sampled and that takes >effect for the lifetime of the bucket.

A bucket created via Shell, when global flag (assuming ozone.om.enable.filesystem.paths=true), they will follow FS semantics and with slight S3 incompatibility.
So, a bucket created via Shell, when global flag (assuming ozone.om.enable.filesystem.paths=false), they will follow S3 semantics and with broken FS semantics or completely disallow.

Written from my understanding, as I have not got the complete context of the proposal.

I might be missing somethings here.

Copy link
Contributor

@arp7 arp7 Sep 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an existing bucket can be exposed created via CLI to be exposed to S3, what semantics that bucket will get?

If the bucket was created via FS interface, it will support FS semantics.

Buckets creation is possible via only OFS, what about O3fs?

Good point, for buckets created via the Ozone shell, we could accept a command-line flag. The default can be filesystem because S3 buckets are traditionally created via the S3 API. You're right this needs some more discussion.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Different behavior on bucket level seems to be an interesting idea.

For buckets created via FS interface, the FS semantics will always take precedence.

How would you define the behavior of bucket is created from S3?

I suppose in this case we should support 100% AWS S3 compatibility (without forced normalization).

But how would o3fs/ofs work in case of s3 buckets:

  1. Partial view from ofs (incompatible keys are hidden)
  2. ofs/o3fs is disabled (exception), no intermediate directories are created.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, one disadvantage: bucket level settings have increased complexity. It's harder to define the expected behavior for a specific path. Cluster level settings is easie, as there is one global behavior for the setup.


## Proposed solution
| ozone.om.intermediate.dir.generation= | true |
|-|-|-|
| create itermediate dirs | YES |
| normalize key names from `ofs/o3fs` | YES |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no special normalize is needed, as we use Path Object in FS, key names are normalized and sent to OM

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I just tried to show here this out-of-the-box behavior. But agree.

We have it for free and actually this couldn't be removed: if we use ofs/o3fs, the keys from ofs/o3fs should always be normalized.

| force to normalize key names of `s3` interface | **NO** |
| `s3` key `/a/b/c` available from `ofs/o3fs` | YES |
| `s3` key `/a/b//c` available from `ofs/o3fs` | NO |
| `s3` key `/a/b//c` available from `s3` | *YES* (100% AWS compatibility) |

### S3/HCFS Interoperability

# Proposed solution

In short:

**I propose to make it possible to configure **normalization** and **intermediate dir creation**, independent from each other**

It can be done in multiple ways. For the sake of simplicity, let's imagine two configuration option

| configuration | behavior |
|-|-|
| `ozone.om.enable.filesystem.paths=true` | Enable intermediate dir generation **AND** key name normalization
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so even if the other setting is false(ozone.om.enable.intermediate.dirs = false), we create intermediate directories?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And do we need this AND key name normalization as anyway, we have another config to define this behavior, which can be handled from code, instead of giving some additional meaning to the config?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am open to reorganize the configuration in any way. In this model the two configuration are independent. Existing config means CREATE_DIR+NORMALIZE, new config is just CREATE_DIR.

They are independent and not matrix.

But we can switch back to the original version.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bq. Existing config means CREATE_DIR+NORMALIZE, new config is just CREATE_DIR.

Are these the only two cases that are useful? do we need to support other combinations?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question, there are three useful cases IMHO:

  1. Do nothing (neither normalize, nor create dir) --> Ozone can be used only from S3, ofs/o3fs is inconsistent due to the missing intermediate directories (I suggest to throw exception in this case for ofs/o3fs)
  2. create dirs, don't normalize --> 100% AWS compatibility, partial view from ofs (invalid keys not visible from ofs. eg /a/b/c////d)
  3. create dirs, normalize --> reduced AWS s3 compatibility, full ofs view

The last option is: normalize but don't create dirs --> it doesn't make sense, as without creating intermediate dirs, ofs is not usable, therefore we don't need normalization.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Is this config still OM config?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so, but we can remove om. As it's not required to know from a config where is it used. It's an important Ozone config. But I am open to use any config name.

| `ozone.om.enable.intermediate.dirs=true` | Enable only the intermediate dir generation

## S3/HCFS Interoperability

**In case of intermediate directory generation is enabled (with either of the configuraiton keys)**:

When somebody creates a new key like `/a/b/c/d`, the same key should be visible from HCFS (`o3fs//` or `o3://`). `/a`, `/a/b` and `/a/b/c` should be visible as directories from HCFS.

S3 should list only the `/a/b/c/d` keys, (`/a`, `/a/b`, `/a/b/c` keys **won't be visible**!)
S3 should list only the `/a/b/c/d` keys, (`/a`, `/a/b`, `/a/b/c` keys, created to help HCFS, **won't be visible** if the key is created from S3)

This can be done with persisting an extra flag with the implicit directory entries. These entries can be modified if they are explicit created.

(This flag should be added only for the keys which are created by S3. `ofs://` and `of3fs://` can create explicit directories all the time)
This flag should be added only for the keys which are created by S3. `ofs://` and `of3fs://` create explicit directories all the time.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These entries can be modified if they are explicit created.
Can you explain a little more about this statement?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If any key is created from s3 interface but it already exists but explicit=false flag, the flag should be changed to explicit=true, to make it visible from s3.

Copy link
Contributor

@xiaoyuyao xiaoyuyao Sep 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S3 should list only the /a/b/c/d keys, (/a, /a/b, /a/b/c keys, created to help HCFS, won't be visible if the key is created from S3)

what if user create additional files under intermediate dirs such as /a/b/d via FS interface, we still want to show them in this case for interop?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compatibility story is only important when somebody uses s3 interface. S3 gateway expected to be compatible with AWS S3.

But there is no rule limtations about showing something for S3G which is created from ofs/o3fs. From this point of view ofs/o3fs are external clients which can do anything, there couldn't be any excepttations in s3g.

  • Directories created by ofs/o3fs can be shown from s3 all the time
  • During key S3 creation intermediate directories should be created but (by default) hidden to S3
  • Unless somebody creates them with ofs interface. In those case they can be visible.


### Handling of the incompatible paths
Advantages of this approach:

Creating intermediate directories might not be possible if path contains illegal characters or can't be parsed as a file system path. **These keys will be invisible from HCFS** by default. They will be ignored during the normal file list.
1. HCFS and S3 can work together
2. S3 behavior is closer to the original AWS s3 behavior (when `/a/b/c` key is created `/a/b` won't be visible)

## Handling of the incompatible paths

This behavior can be adjusted by a new configuration variable (eg. `ozone.keyspace.scheme`) based on the values:
As it's defined above the intermediate directory generation and normalization are two independent settings. (It's possible to choose only to create the intermediate directories).

* `permissive` (default): any key name can be used from S3 interface but from HCFS only the valid key names (keys which can be transformed to a file system path) will be visible. The option provides the highest AWS s3 compatibility.
* `strict`: This is the opposite: any non file-system compatible key name will be rejected by an exception. This is a safe choice to make everything visible from HCFS, but couldn't guarantee 100% AWS S3 compatibility as some key names couldn't be used.
* `normalize`: It's similar to the `strict` but -- instead of throwing an exception -- normalizes the key names to file-system compatible names. It breaks the AWS compatibility (some keys which are written will be readable from other path), but a safe choice when HCFS is heavliy used.
**If normalization is choosen**: (`ozone.om.enable.filesystem.paths=true`), all the key names will be normalized to fs-compatible name. It may cause a conflict (error) if the normalized key is already exists (or exists as a file instead of directory)

### Using Ozone in object-store only mode
**Without normalization (`ozone.om.enable.intermediate.dirs=true`)**:

Creating intermediate directories might not be possible if path contains illegal characters or can't be parsed as a file system path. **These keys will be invisible from HCFS** by default. They will be ignored during the normal file list.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The illegal char from S3 path can be encoded into FS path except the /.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.. also can be tricky.

But in general, I agree. We might be more permissive and show some of these elements even in ofs/o3fs. For example a/b/c//d might be possible to show as /a/b/c/d. But even if some of these are visible, we should accept that ofs/o3fs doesn't provide a full view when 100% AWS compatibility is requested.


## Using Ozone in object-store only mode

Creating intermediate directories can have some overhead (write amplification is increased if many keys are written with different prefixes as we need an entry for each prefixes). This write-amplification can be handled with the current implementation: based on the measurements RocksDB has no problems with billions of keys.

But it's possible to use a specific configuration key (like `ozone.om.enable.filesystem.paths`) to **disable** the default behavior of creating directory entries. But in this case all the file system calls (any HCFS call) **should be disabled and throw an exception** as consistency couldn't be guaranteed from there. (But Ozone can be used as a pure S3 replacement without using as a HCFS).
If none of the mentioned configurations are enabled, the intermediate directories won't be created. But in this case, the consitent view of `ofs/o3fs` couldn't be guaranteed, so `ofs/o3fs` **should be disabled and throw an exception** (But Ozone can be used as a pure S3 replacement without using as a HCFS).

## Problematic cases
# Problematic cases

As described in the previous section there are some cases which couldn't be supported out-of-the-box due to the differences between the flat key-space and file-system hierarchy. These cases are collected here together with the information how existing tools (AWS console, AWS cli, AWS S3A Hadoop connector) behaves.

### Empty directory path
## Empty directory path

With a pure object store keys with empty directory names can be created.

Expand All @@ -120,11 +174,10 @@ Behavior:

Proposed behavior:

* `permissive`: `/c` is not accessible, `/a/b` directory doesn't contain this entry
* `strict`: throwing exception
* `normalize`: key stored as `/a/b/c`
* `ozone.om.enable.intermediate.dirs=true`: `/y` is not accessible, `/a/b` directory doesn't contain this entry
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/y is not accessible from FS, but will be accessible from S3 correct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. exactly

* `ozone.om.enable.filesystem.paths=true`: key stored as `/a/b/c`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this, visible from both, but in S3 it will be shown with normalized name?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, exactly.


### Path with invalid characters (`..`,`.`)
## Path with invalid characters (`..`,`.`)

Path segments might include parts which has file system semantics:

Expand All @@ -140,11 +193,10 @@ Behavior:

Proposed behavior:

* `permissive`: `e` and `f` are not visible
* `strict`: throwing exception
* `normalize`: key stored as `/a/e` and `a/b/f`
* `ozone.om.enable.intermediate.dirs=true`: `e` and `f` are not visible
* `ozone.om.enable.filesystem.paths=true`: key stored as `/a/e` and `a/b/f`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also add info on visibility and how it will be displayed also?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I added.


### Key and directory with the same name
## Key and directory with the same name

It is possible to create directory and key with the same name in AWS:

Expand All @@ -161,10 +213,9 @@ Behavior:
Proposed behavior:

* `permissive`: show both the file and the directory with the same name (similar to S3A)
* `strict`: throwing exception when the second is created
* `normalize`: throwing exception when the second one is created
* `ozone.om.enable.filesystem.paths=true`: throwing exception when the second one is created

### Directory entry created with file content
## Directory entry created with file content

In this case we create a directory (key which ends with `/`) but with real file content:

Expand All @@ -180,31 +231,52 @@ Behavior:
Proposed behavior:

* `permissive`: possible but `i/` is hidden from o3fs/ofs
* `strict`: throwing exception when created
* `normalize`: throwing exception when created
* `normalize`: key name is normalized to real key name

### Create key and explicit create parent dir
## Create key and explicit create parent dir

```
aws s3api put-object --bucket ozonetest --key e/f/g/
aws s3api put-object --bucket ozonetest --key e/f/
```


Behavior:

* S3 can support it without any problem

Proposed behavior:

After the first command `/e/f` and `/e` entries created in the key space (as they are required by `ofs`/`o3fs`) but **with a specific flag** (explicit=false).
After the first command `/e/f/` and `/e/` entries created in the key space (as they are required by `ofs`/`o3fs`) but **with a specific flag** (explicit=false).

AWS S3 list-objects API should exclude those entries from the result (!).

Second command execution should modify the flag of `/e/f` key to (explicit=true).
Second command execution should modify the flag of `/e/f/` key to (explicit=true).

## Create parent dir AND key with S3a

This is the problem which is reporeted by [HDDS-4209](https://issues.apache.org/jira/browse/HDDS-4209)

```
hdfs dfs -mkdir -p s3a://b12345/d11/d12 # -> Success

hdfs dfs -put /tmp/file1 s3a://b12345/d11/d12/file1 # -> fails with below error
```

Proposed behavior:

* `ozone.om.enable.intermediate.dirs=true`: shold work without error
* `ozone.om.enable.filesystem.paths=true`: should work without error.

This is an `ofs`/`o3fs` question not an S3. The directory created in the first step shouldn't block the creation of the file. This can be a **mandatory** normalization for `mkdir` directory creation. As it's an HCFS operation, s3 is not affected. Entries created from S3 can be visible from s3 without any problem.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will block ofs/o3fs also, as it is not a directory in ozone, it is a file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change the type to a directory when it's empty and name ends with / ?


Note: using `o3fs://` or `ofs://` all the intermediate directories can be (explicit=true)
## Create file and directory with S3

### Create key and delete parent key
This problem is reported in HDDS-4209, thanks to @Bharat

```
hdfs dfs -mkdir -p s3a://b12345/d11/d12 -> Success

hdfs dfs -put /tmp/file1 s3a://b12345/d11/d12/file1
```

This is very similar to the previous one but the direction is opposite. If directory key entry is still required it should be modified to (explicit=false) and excluded from any listing from the object store interface.
In this case first a `d11/d12/` key is created. The intermediate key creation logic in the second step should use it as a directory instead of throwing an exception.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

d11/d12 is created without traiiling "/"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it locally and found the trailing /. Are you sure?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Posted my comment in HDDS-4209. Refer for more info

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks to explain it. I tested it with pure AWS S3 and s3a. The trailing / seems to be missing due to a bug in our normalization, and it's not and s3a behavior. I think we should fix the normalization.