GH-37670: [C++] IO FileInterface extend from enable_shared_from_this#37713
GH-37670: [C++] IO FileInterface extend from enable_shared_from_this#37713bkietz merged 8 commits intoapache:mainfrom
Conversation
|
|
ec41eee to
624612b
Compare
|
Ooops.
If |
| RETURN_NOT_OK(UploadPart("", 0)); | ||
| } | ||
|
|
||
| auto self = shared_from_this(); |
There was a problem hiding this comment.
Another problem is that we cannot call shared_from_this in dtor ( https://stackoverflow.com/questions/28338978/stdenable-shared-from-this-is-it-allowed-to-call-shared-from-this-in-destru ), so I separate a FinishPartUploadAfterFlush.
If that's the case, then we can move |
|
Sure, let me try it |
|
After some trying, we have However, because of the derive is virtual, we need to change // Default ReadMetadataAsync() implementation: simply issue the read on the context's
// executor
Future<std::shared_ptr<const KeyValueMetadata>> InputStream::ReadMetadataAsync(
const IOContext& ctx) {
std::shared_ptr<InputStream> self = std::dynamic_pointer_cast<InputStream>(shared_from_this());
return DeferNotOk(internal::SubmitIO(ctx, [self] { return self->ReadMetadata(); }));
}Do you think this is ok? @pitrou |
|
cc @bkietz for opinions on |
|
|
bkietz
left a comment
There was a problem hiding this comment.
This looks good, just a few nits
009d8cb to
d87f09b
Compare
|
@bkietz I've resolve the comment, would you mind take a look again? |
bkietz
left a comment
There was a problem hiding this comment.
Sorry, I wasn't specific enough:
Co-authored-by: Benjamin Kietzman <bengilgit@gmail.com>
Hmm seems this is not caused by me...? |
|
Yes, that seems to be known flakiness #30568 I've restarted that CI job |
|
After merging your PR, Conbench analyzed the 6 benchmarking runs that have been run so far on merge-commit 0e6a683. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. It also includes information about possible false positives for unstable benchmarks that are known to sometimes produce them. |
…_this (apache#37713) ### Rationale for this change S3 `FlushAsync` might has lifetime problem, this patch fixes that. ### What changes are included in this PR? 1. Move `enable_shared_from_this` to `FileInterface` 2. Update S3 `FlushAsync` 3. Implement sync Flush to avoid call `share_from_this` in dtor. ### Are these changes tested? no ### Are there any user-facing changes? no * Closes: apache#37670 Lead-authored-by: mwish <maplewish117@gmail.com> Co-authored-by: mwish <1506118561@qq.com> Co-authored-by: Benjamin Kietzman <bengilgit@gmail.com> Signed-off-by: Benjamin Kietzman <bengilgit@gmail.com>
…_this (apache#37713) ### Rationale for this change S3 `FlushAsync` might has lifetime problem, this patch fixes that. ### What changes are included in this PR? 1. Move `enable_shared_from_this` to `FileInterface` 2. Update S3 `FlushAsync` 3. Implement sync Flush to avoid call `share_from_this` in dtor. ### Are these changes tested? no ### Are there any user-facing changes? no * Closes: apache#37670 Lead-authored-by: mwish <maplewish117@gmail.com> Co-authored-by: mwish <1506118561@qq.com> Co-authored-by: Benjamin Kietzman <bengilgit@gmail.com> Signed-off-by: Benjamin Kietzman <bengilgit@gmail.com>
Rationale for this change
S3
FlushAsyncmight has lifetime problem, this patch fixes that.What changes are included in this PR?
enable_shared_from_thistoFileInterfaceFlushAsyncshare_from_thisin dtor.Are these changes tested?
no
Are there any user-facing changes?
no