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

Remove Nested async and Fallibility from ObjectStore::list #4930

Merged
merged 4 commits into from
Oct 17, 2023

Conversation

tustvold
Copy link
Contributor

@tustvold tustvold commented Oct 13, 2023

Which issue does this PR close?

Closes #4946.

Rationale for this change

Having two layers of asynchrony and fallibility makes for a rather obnoxious interface. Removing this makes for better client ergonomics, at the expense of slightly more arcane logic to implement the ObjectStore

What changes are included in this PR?

Are there any user-facing changes?

@tustvold tustvold added the api-change Changes to the arrow API label Oct 13, 2023
@tustvold tustvold requested review from alamb and wjones127 October 13, 2023 13:42
@github-actions github-actions bot added the object-store Object Store Interface label Oct 13, 2023
@@ -1158,21 +1156,14 @@ mod tests {

let store = LocalFileSystem::new_with_prefix(root.path()).unwrap();

// `list` must fail
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We no longer have this peculiar arrangement where an error can emerge in two different places

Comment on lines -1249 to +1240
let result: Vec<_> = integration
.list(prefix)
.await
.unwrap()
.try_collect()
.await
.unwrap();
let result: Vec<_> = integration.list(prefix).try_collect().await.unwrap();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is much nicer imo

Comment on lines 163 to 164
let s = self.inner.list_with_offset(prefix, offset);
let fut = Arc::clone(&self.semaphore)
Copy link
Contributor Author

@tustvold tustvold Oct 13, 2023

Choose a reason for hiding this comment

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

This somewhat peculiar ordering is required because the returned stream cannot borrow prefix, only self

@tustvold tustvold marked this pull request as draft October 13, 2023 13:54
Copy link
Member

@wjones127 wjones127 left a comment

Choose a reason for hiding this comment

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

@tustvold this seems reasonable. I'd be +1 on this change.

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

I agree that this is a nicer interface than an async function that returns a stream

@tustvold tustvold marked this pull request as ready for review October 17, 2023 14:17
Copy link
Member

@wjones127 wjones127 left a comment

Choose a reason for hiding this comment

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

Looks good. Should we have an issue for this?

@tustvold tustvold merged commit fa7a61a into apache:master Oct 17, 2023
13 checks passed
@alamb
Copy link
Contributor

alamb commented Oct 17, 2023

cc @carols10cents

Looks good. Should we have an issue for this?

Looks like @tustvold filed #4946

@alamb
Copy link
Contributor

alamb commented Oct 17, 2023

I think this means we need to release another SemVer change for object_store on the next release

@tustvold
Copy link
Contributor Author

I think this means we need to release another SemVer change for object_store on the next release

Indeed, there are already also some other breaking changes already merged and some others in the pipeline

@alamb
Copy link
Contributor

alamb commented Nov 22, 2023

I wonder if it was intended that list_with_delimiter is still async and returns Result?

It seems a strangely different API

https://docs.rs/object_store/latest/object_store/trait.ObjectStore.html#tymethod.list_with_delimiter

@tustvold
Copy link
Contributor Author

I wonder if it was intended that list_with_delimiter is still async and returns Result?

Yes it was intended as list_with_delimiter does not return a stream

@alamb
Copy link
Contributor

alamb commented Dec 11, 2023

BTW I think this change has also made it somewhat harder to implement "fail fast" semantics for object store clients, something we saw in IOx and @andygrove noticed while updating ballista

slack reference: https://the-asf.slack.com/archives/C01QUFS30TD/p1702312372903249

@tustvold
Copy link
Contributor Author

tustvold commented Dec 11, 2023

The following should do the trick

futures::stream::once(futures::future::once(Err(...))).boxed()

@andygrove
Copy link
Member

I ended up with the following to resolve this:

stream::once(async { Err(...)  }).boxed()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-change Changes to the arrow API object-store Object Store Interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplify ObjectStore::List
4 participants