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

fix: an error while executing trimShards should not interrupt the exe… #1707

Merged
merged 2 commits into from
Dec 7, 2023

Conversation

YangKian
Copy link
Contributor

@YangKian YangKian commented Dec 7, 2023

PR Description

Type of change

  • Bug fix

Summary of the change and which issue is fixed

Main changes: TODO


Checklist

  • I have run format.sh under script
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes

trim shards r@Rid{..}
| rShardId `elem` shards = do
try (S.trim scLDClient rShardId (rBatchId - 1)) >>= \case
Left (e:: SomeException)
Copy link
Member

Choose a reason for hiding this comment

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

Why not use SomeStoreException?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried SomeStoreException first, but I didn't find a way to pattern match SomeStoreException to a specific exception, such as S.TOOBIG

Copy link
Member

Choose a reason for hiding this comment

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

I haven't looked at the details, but I think at least catches can do this job. You do not need to do pattern match.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does S.trim return exceptions other than SomeHStoreException, if not then catching SomeException and SomeHStoreException is actually the same?
Also, the requirement is that no exceptions should interrupt execution, so if it returns something else, even if I use catches, I still have to match SomeException.

Copy link
Member

Choose a reason for hiding this comment

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

Does S.trim return exceptions other than SomeHStoreException

Yes, it's possible, but seldom.

if not then catching SomeException and SomeHStoreException is actually the same

No, they are not the same, for example, while dealing with AsyncException

so if it returns something else, even if I use catches, I still have to match SomeException

It depends on. But mostly, this is what you should not do.

@4eUeP 4eUeP merged commit 6a3f6ad into hstreamdb:main Dec 7, 2023
10 checks passed
@YangKian YangKian deleted the fix-trim branch December 7, 2023 09:40
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

Successfully merging this pull request may close these issues.

2 participants