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

[aliyun-drive] write op cannot overwrite existing files #4780

Closed
imWildCat opened this issue Jun 20, 2024 · 10 comments
Closed

[aliyun-drive] write op cannot overwrite existing files #4780

imWildCat opened this issue Jun 20, 2024 · 10 comments

Comments

@imWildCat
Copy link
Contributor

21:45:27 [DEBUG] (15) hyper_util::client::legacy::pool: pooling idle connection for ("https", openapi.alipan.com)
21:45:27 [DEBUG] (15) hyper_util::client::legacy::pool: reuse idle connection for ("https", openapi.alipan.com)
21:45:27 [DEBUG] (15) hyper_util::client::legacy::pool: pooling idle connection for ("https", openapi.alipan.com)
21:45:27 [DEBUG] (15) hyper_util::client::legacy::pool: reuse idle connection for ("https", openapi.alipan.com)
21:45:27 [DEBUG] (15) hyper_util::client::legacy::pool: pooling idle connection for ("https", openapi.alipan.com)
21:45:27 [DEBUG] (15) opendal::services: service=aliyun_drive operation=write path=apps/infoflow/default.ifvault/v1/meta/metadata/manifest.json -> start writing
21:45:27 [DEBUG] (15) hyper_util::client::legacy::pool: reuse idle connection for ("https", openapi.alipan.com)
21:45:28 [DEBUG] (15) hyper_util::client::legacy::pool: pooling idle connection for ("https", openapi.alipan.com)
21:45:28 [WARN] service=aliyun_drive operation=Writer::close path=apps/infoflow/default.ifvault/v1/meta/metadata/manifest.json written=654B -> data close failed: AlreadyExists (permanent) at Writer::close, context: { service: aliyun_drive, path: apps/infoflow/default.ifvault/v1/meta/metadata/manifest.json, written: 654 } => file exists
21:45:28 [WARN] writer has not been closed or aborted, must be a bug
21:45:28 [ERROR] Failed to saved remote config: Remote storage manifest error: cannot write manifest: OpdalError(AlreadyExists (permanent) at Writer::close => file exists

I also ran the behavior test of aliyun drive on main, failed ones:

OPENDAL_TEST=aliyun_drive cargo test behavior --features tests --features services-aliyun-drive -- --nocapture

    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.17s
     Running unittests src/lib.rs (target/debug/deps/opendal-0679e4758c22bc6e)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 129 filtered out; finished in 0.00s

     Running tests/behavior/main.rs (target/debug/deps/behavior-d9d1bf5182e363cd)

running 114 tests
test behavior::test_copy_non_existing_source                           ... ok
test behavior::test_copy_source_dir                                    ... ok
test behavior::test_create_dir                                         ... ok
test behavior::test_create_dir_existing                                ... ok
test behavior::test_delete_empty_dir                                   ... ok
test behavior::test_delete_not_existing                                ... ok
test behavior::test_copy_self                                          ... ok
test behavior::test_check                                              ... ok
test behavior::test_delete_with_special_chars                          ... ok
test behavior::test_delete_file                                        ... ok
test behavior::test_copy_target_dir                                    ... ok
test behavior::test_copy_nested                                        ... ok
test behavior::test_copy_file_with_non_ascii_name                      ... ok
test behavior::test_remove_one_file                                    ... ok
test behavior::test_copy_overwrite                                     ... ok
test behavior::test_list_non_exist_dir                                 ... ok
test behavior::test_list_dir_with_metakey_complete                     ... ok
test behavior::test_list_dir_with_metakey                              ... ok
test behavior::test_list_with_start_after                              ... ok
test behavior::test_list_prefix                                        ... ok
test behavior::test_copy_file_with_ascii_name                          ... ok
test behavior::test_list_dir                                           ... ok
test behavior::test_list_sub_dir                                       ... ok
test behavior::test_list_dir_with_file_path                            ... ok
test behavior::test_list_file_with_recursive                           ... ok
test behavior::test_read_range                                         ... ok
test behavior::test_read_full                                          ... ok
test behavior::test_list_nested_dir                                    ... ok
test behavior::test_read_with_if_match                                 ... ok
test behavior::test_read_with_if_none_match                            ... ok
test behavior::test_read_not_exist                                     ... ok
test behavior::test_read_with_dir_path                                 ... ok
test behavior::test_read_with_override_cache_control                   ... ok
test behavior::test_read_with_override_content_disposition             ... ok
test behavior::test_read_with_override_content_type                    ... ok
test behavior::test_list_root_with_recursive                           ... ok
test behavior::test_list_empty_dir                                     ... ok
test behavior::test_rename_non_existing_source                         ... ok
test behavior::test_rename_source_dir                                  ... ok
test behavior::test_read_with_special_chars                            ... ok
test behavior::test_rename_self                                        ... ok
test behavior::test_reader                                             ... ok
test behavior::test_rename_target_dir                                  ... ok
test behavior::test_stat_dir                                           ... ok
test behavior::test_stat_file                                          ... ok
thread '<unnamed>' panicked at tests/behavior/async_list.rs:520:5:
assertion `left == right` failed
  left: ["x/x/", "x/x/y", "x/y", "x/yy"]
 right: ["x/x/", "x/x/x/", "x/x/x/x/", "x/x/x/y", "x/x/y", "x/y", "x/yy"]
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
test behavior::test_list_dir_with_recursive                            ... FAILED
thread '<unnamed>' panicked at tests/behavior/async_list.rs:556:5:
assertion `left == right` failed
  left: ["x/", "x/y", "x/yy"]
 right: ["x/", "x/x/", "x/x/x/", "x/x/x/x/", "x/x/x/y", "x/x/y", "x/y", "x/yy"]
test behavior::test_list_dir_with_recursive_no_trailing_slash          ... FAILED
test behavior::test_stat_not_exist                                     ... ok
test behavior::test_stat_with_if_match                                 ... ok
test behavior::test_stat_with_if_none_match                            ... ok
test behavior::test_stat_with_override_cache_control                   ... ok
test behavior::test_stat_with_override_content_disposition             ... ok
test behavior::test_stat_with_override_content_type                    ... ok
test behavior::test_stat_root                                          ... ok
test behavior::test_remove_all                                         ... ok
test behavior::test_write_with_empty_content                           ... ok
test behavior::test_write_with_dir_path                                ... ok
test behavior::test_rename_overwrite                                   ... FAILED
test behavior::test_write_with_cache_control                           ... ok
test behavior::test_write_with_content_type                            ... ok
test behavior::test_write_with_content_disposition                     ... ok
test behavior::test_stat_nested_parent_dir                             ... FAILED
test behavior::test_write_only                                         ... ok
test behavior::test_rename_file                                        ... ok
test behavior::test_write_with_special_chars                           ... ok
test behavior::test_stat_not_cleaned_path                              ... ok
test behavior::test_rename_nested                                      ... ok
test behavior::test_writer_abort                                       ... ok
test behavior::test_writer_abort_with_concurrent                       ... ok
test behavior::test_stat_with_special_chars                            ... FAILED
test behavior::test_blocking_copy_non_existing_source                  ... ok
test behavior::test_blocking_copy_source_dir                           ... ok
thread '<unnamed>' panicked at tests/behavior/async_list.rs:227:5:
assertion `left == right` failed
  left: ["test_list_rich_dir/file-10", "test_list_rich_dir/file-9"]
 right: ["test_list_rich_dir/file-0", "test_list_rich_dir/file-1", "test_list_rich_dir/file-10", "test_list_rich_dir/file-2", "test_list_rich_dir/file-3", "test_list_rich_dir/file-4", "test_list_rich_dir/file-5", "test_list_rich_dir/file-6", "test_list_rich_dir/file-7", "test_list_rich_dir/file-8", "test_list_rich_dir/file-9"]
test behavior::test_list_rich_dir                                      ... FAILED
test behavior::test_writer_write                                       ... ok
test behavior::test_writer_sink                                        ... ok
test behavior::test_writer_write_with_concurrent                       ... ok
test behavior::test_blocking_create_dir                                ... ok
test behavior::test_blocking_copy_target_dir                           ... ok
test behavior::test_blocking_copy_self                                 ... ok
test behavior::test_writer_futures_copy_with_concurrent                ... ok
test behavior::test_blocking_create_dir_existing                       ... ok
test behavior::test_writer_futures_copy                                ... ok
test behavior::test_writer_sink_with_concurrent                        ... ok
test behavior::test_blocking_list_non_exist_dir                        ... ok
test behavior::test_blocking_copy_file                                 ... ok
test behavior::test_blocking_remove_one_file                           ... ok
test behavior::test_blocking_list_dir                                  ... ok
test behavior::test_blocking_delete_file                               ... ok
test behavior::test_blocking_list_dir_with_metakey                     ... ok
test behavior::test_blocking_list_dir_with_metakey_complete            ... ok
test behavior::test_blocking_copy_nested                               ... ok
test behavior::test_blocking_read_not_exist                            ... ok
test behavior::test_blocking_copy_overwrite                            ... ok
test behavior::test_blocking_rename_non_existing_source                ... ok
test behavior::test_blocking_rename_source_dir                         ... ok
test behavior::test_blocking_list_file_with_recursive                  ... ok
test behavior::test_blocking_rename_self                               ... ok
test behavior::test_blocking_read_range                                ... ok
test behavior::test_blocking_read_full                                 ... ok
test behavior::test_blocking_rename_target_dir                         ... ok
test behavior::test_blocking_stat_dir                                  ... ok
test behavior::test_blocking_stat_not_exist                            ... ok
test behavior::test_blocking_rename_file                               ... ok
test behavior::test_blocking_write_with_dir_path                       ... ok
test behavior::test_blocking_stat_file                                 ... ok
test behavior::test_blocking_stat_with_special_chars                   ... ok
test behavior::test_blocking_write_file                                ... ok
test behavior::test_blocking_write_with_special_chars                  ... ok
test behavior::test_blocking_rename_nested                             ... ok
test behavior::test_blocking_rename_overwrite                          ... ok
test behavior::test_blocking_list_dir_with_recursive                   ... ok
test behavior::test_blocking_list_dir_with_recursive_no_trailing_slash ... ok
test behavior::test_blocking_remove_all                                ... ok
say done
test behavior::test_delete_stream                                      ... ok

failures:

---- behavior::test_list_dir_with_recursive ----
test panicked: assertion `left == right` failed
  left: ["x/x/", "x/x/y", "x/y", "x/yy"]
 right: ["x/x/", "x/x/x/", "x/x/x/x/", "x/x/x/y", "x/x/y", "x/y", "x/yy"]

---- behavior::test_list_dir_with_recursive_no_trailing_slash ----
test panicked: assertion `left == right` failed
  left: ["x/", "x/y", "x/yy"]
 right: ["x/", "x/x/", "x/x/x/", "x/x/x/x/", "x/x/x/y", "x/x/y", "x/y", "x/yy"]

---- behavior::test_rename_overwrite ----
NotFound (persistent) at rename, context: { service: aliyun_drive, from: 670c0417-5374-4cbb-8b7a-c39b6f30d1aa, to: 69b4a449-77de-4cb9-9c33-461145ae4006 } => The resource file cannot be found. file not exist

---- behavior::test_stat_nested_parent_dir ----
NotFound (persistent) at stat, context: { service: aliyun_drive, path: 1359aa3a-7493-4f6b-b8e5-1fa89a2bdc9f/ } => The resource file cannot be found. file not exist

---- behavior::test_stat_with_special_chars ----
NotFound (persistent) at stat, context: { service: aliyun_drive, path: 5fb0fc1a-4263-49bf-83f3-005265b7a24b !@#$%^&()_+-=;',.txt } => The resource file cannot be found. file not exist

---- behavior::test_list_rich_dir ----
test panicked: assertion `left == right` failed
  left: ["test_list_rich_dir/file-10", "test_list_rich_dir/file-9"]
 right: ["test_list_rich_dir/file-0", "test_list_rich_dir/file-1", "test_list_rich_dir/file-10", "test_list_rich_dir/file-2", "test_list_rich_dir/file-3", "test_list_rich_dir/file-4", "test_list_rich_dir/file-5", "test_list_rich_dir/file-6", "test_list_rich_dir/file-7", "test_list_rich_dir/file-8", "test_list_rich_dir/file-9"]


failures:
    behavior::test_list_dir_with_recursive
    behavior::test_list_dir_with_recursive_no_trailing_slash
    behavior::test_rename_overwrite
    behavior::test_stat_nested_parent_dir
    behavior::test_stat_with_special_chars
    behavior::test_list_rich_dir

test result: FAILED. 108 passed; 6 failed; 0 ignored; 0 measured; 0 filtered out; finished in 297.56s
@yuchanns

This comment was marked as outdated.

@yuchanns
Copy link
Member

I've created a PR. Could you help test if the issue has been resolved? #4781

@Xuanwo
Copy link
Member

Xuanwo commented Jun 21, 2024

I'm a bit confused as to how aliyun-drive passed our behavior test. Didn't we have a case where the same file path was written twice?

@yuchanns
Copy link
Member

Didn't we have a case where the same file path was written twice?

Maybe you can check with a modified time.

@Xuanwo
Copy link
Member

Xuanwo commented Jun 21, 2024

Maybe you can check with a modified time.

Seems a good idea.

By the way, how about writing two different pieces of content and checking if we can retrieve the latest one?

@imWildCat
Copy link
Contributor Author

[0] 03:25:45 [WARN] writer has not been closed or aborted, must be a bug
[0] 03:25:45 [ERROR] Failed to saved remote config: Remote storage manifest error: cannot write manifest: OpdalError(AlreadyExists (permanent) at Writer::close => file exists
[0] 
[0] Context:
[0]    service: aliyun_drive
[0]    path: apps/infoflow/default.ifvault/v1/meta/metadata/manifest.json
[0]    written: 536
[0] )

This bug still exists with cf7580e:

opendal = { git = "https://github.com/apache/opendal.git", revision = "cf7580e4e5ccb30cae3347963404c89511af441e" }

@yuchanns

This comment was marked as outdated.

@yuchanns
Copy link
Member

Please give #4821 a try.

@imWildCat
Copy link
Contributor Author

thank you! I'll try today or tomorrow

@imWildCat
Copy link
Contributor Author

@yuchanns sorry for the delay!

I works perfectly.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants