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

feat(layers/blocking): add blocking layer #2780

Merged
merged 12 commits into from
Aug 7, 2023
Merged

Conversation

yah01
Copy link
Contributor

@yah01 yah01 commented Aug 4, 2023

@yah01 yah01 requested a review from Xuanwo as a code owner August 4, 2023 10:30
@yah01 yah01 marked this pull request as draft August 4, 2023 10:34
@yah01 yah01 changed the title Add blocking layer feat(layers/blocking): add blocking layer Aug 4, 2023
Copy link
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

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

Great!

core/src/layers/blocking.rs Outdated Show resolved Hide resolved
core/src/layers/blocking.rs Outdated Show resolved Hide resolved
core/src/layers/blocking.rs Outdated Show resolved Hide resolved
core/src/types/operator/builder.rs Outdated Show resolved Hide resolved
core/src/layers/blocking.rs Outdated Show resolved Hide resolved
core/src/layers/blocking.rs Outdated Show resolved Hide resolved
@yah01 yah01 force-pushed the add-blocking-layer branch 6 times, most recently from d18ef06 to 266689f Compare August 6, 2023 10:01
@yah01
Copy link
Contributor Author

yah01 commented Aug 6, 2023

Hi @Xuanwo The sftp related tests failed, but I don't get it how this occurs, I did clone the Handle from RUNTIME, what's the diff between sftp and the other backends, could you help on this?

@Xuanwo
Copy link
Member

Xuanwo commented Aug 6, 2023

what's the diff between sftp and the other backends, could you help on this?

cc @silver-ymz, do you have any ideas?

@silver-ymz
Copy link
Member

It seems that the dropping of sftp client does some magical things.

thread '<unnamed>' panicked at 'there is no reactor running, must be called from the context of a Tokio 1.x runtime', /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssh-sftp-client-0.13.6/src/file/tokio_compat_file.rs:763:9

@Xuanwo
Copy link
Member

Xuanwo commented Aug 6, 2023

It seems that the dropping of sftp client does some magical things.

Also cc @NobodyXu for some ideas.

@NobodyXu
Copy link
Contributor

NobodyXu commented Aug 6, 2023

It seems that the dropping of sftp client does some magical things.

thread '<unnamed>' panicked at 'there is no reactor running, must be called from the context of a Tokio 1.x runtime', /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssh-sftp-client-0.13.6/src/file/tokio_compat_file.rs:763:9

TokioCompatFile::drop calls tokio::spawn to wait on all write_futures and log the errors if any.

We can change it to only do that if a tokio::Runtime is available.

@NobodyXu
Copy link
Contributor

NobodyXu commented Aug 6, 2023

openssh-sftp-client v0.13.7 has released, which should fix this.

@Xuanwo
Copy link
Member

Xuanwo commented Aug 6, 2023

openssh-sftp-client v0.13.7 has released, which should fix this.

Great! Thanks a lot!

@yah01
Copy link
Contributor Author

yah01 commented Aug 7, 2023

Hi @Xuanwo, the sftp problem and the BlockingReader problem are blocking this PR, just wonder whether you are working on them? I could resolve them if you haven't started (should I create two new PRs?)

@NobodyXu
Copy link
Contributor

NobodyXu commented Aug 7, 2023

Hi @Xuanwo, the sftp problem and the BlockingReader problem are blocking this PR, just wonder whether you are working on them? I could resolve them if you haven't started (should I create two new PRs?)

For the openssh-sftp-client bug, a simple bump is required, IMO you can open a new PR for that (or simply bump it in this PR if you prefer to do that here).

@Xuanwo
Copy link
Member

Xuanwo commented Aug 7, 2023

I have fixed the seek support for blocking reader at: #2799

Signed-off-by: yah01 <[email protected]>
@Xuanwo
Copy link
Member

Xuanwo commented Aug 7, 2023

Hi, @yah01, it's better not to do force push: OpenDAL always squash commits while merging so there is no need to do that.

@Xuanwo
Copy link
Member

Xuanwo commented Aug 7, 2023

I'm guessing we can add following unit tests in blocking layer:

  • init in blocking context, drop in blocking context
  • init in blocking context, drop in async context
  • init in async context, drop in blocking context
  • init in async context, drop in async context

@Xuanwo
Copy link
Member

Xuanwo commented Aug 7, 2023

I'm guessing we can add following unit tests in blocking layer:

  • init in blocking context, drop in blocking context
  • init in blocking context, drop in async context
  • init in async context, drop in blocking context
  • init in async context, drop in async context

This seems not a blocker here, we can improve this in later PRs.

@yah01
Copy link
Contributor Author

yah01 commented Aug 7, 2023

@Xuanwo @NobodyXu It seems the sftp client is still in trouble, any idea?

@Xuanwo
Copy link
Member

Xuanwo commented Aug 7, 2023

@Xuanwo @NobodyXu It seems the sftp client is still in trouble, any idea?

https://github.com/openssh-rust/openssh-sftp-client/blob/main/src/handle.rs#L22C15-L59

Seems OwnedHandle should also need some work.

@yah01
Copy link
Contributor Author

yah01 commented Aug 7, 2023

Hi @NobodyXu , could you release a new version of openssh-sftp-client? Then we can use it for this, I'm going to bump this directly in this PR to make sure it works

@NobodyXu
Copy link
Contributor

NobodyXu commented Aug 7, 2023

Hi @NobodyXu , could you release a new version of openssh-sftp-client? Then we can use it for this, I'm going to bump this directly in this PR to make sure it works

@silver-ymz has released openssh-sftp-client v0.13.8

@Xuanwo
Copy link
Member

Xuanwo commented Aug 7, 2023

has released openssh-sftp-client v0.13.8

@NobodyXu, you are so awesome!

@NobodyXu
Copy link
Contributor

NobodyXu commented Aug 7, 2023

Thank you, but @silver-ymz is the one who fixed the <OwnedHandle as Drop>::drop.

@yah01 yah01 marked this pull request as ready for review August 7, 2023 08:25
@yah01 yah01 requested a review from PsiACE as a code owner August 7, 2023 08:25
@Xuanwo
Copy link
Member

Xuanwo commented Aug 7, 2023

Thank you, but @silver-ymz is the one who fixed the <OwnedHandle as Drop>::drop.

Fantastic! I'm thrilled to have @NobodyXu and @silver-ymz as part of our community!

Copy link
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the work!

We will need some benchmark for blocking layer's perf and make sure it works on different context. But this PR is already good enough to get merged. Let's rocks!

@Xuanwo
Copy link
Member

Xuanwo commented Aug 7, 2023

nextcloud failed for file locked, we should address it by add redis cache for it. Not related with this PR.

@Xuanwo Xuanwo merged commit c17b547 into apache:main Aug 7, 2023
85 of 86 checks passed
@yah01
Copy link
Contributor Author

yah01 commented Aug 7, 2023

Thanks for you guys @Xuanwo @silver-ymz @NobodyXu, it's impossible to get this work done well without your help!

@chitralverma
Copy link

@yah01 amazing, couple of questions regarding this,

  • Are there any user-facing examples to use the blocking API?
  • Which services now support/ don't support blocking API?
  • Is there a separate PR required to update the docs.rs with service-level capabilities? Since this will be part of the next release

@Xuanwo
Copy link
Member

Xuanwo commented Aug 7, 2023

  • Are there any user-facing examples to use the blocking API?

Yes, docs provided at BlockingOperator. This PR doesn't change our public API.

Which services now support/ don't support blocking API?

By adding blocking layers, services that only provide async API can have blocking API now.

Is there a separate PR required to update the docs.rs with service-level capabilities? Since this will be part of the next release

This question is related to #2790. I expect to address them before next release.

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

Successfully merging this pull request may close these issues.

feat: Providing Blocking API support for HTTP based services like S3
5 participants