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

Graceful shutdown of a stream for a single subscription #1201

Open
wants to merge 87 commits into
base: master
Choose a base branch
from

Commits on Apr 27, 2024

  1. Draft of interface changes

    svroonland authored and erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    7a9a6f8 View commit details
    Browse the repository at this point in the history
  2. Remove deprecated for now

    svroonland authored and erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    c8196b3 View commit details
    Browse the repository at this point in the history
  3. Draft implementation

    svroonland authored and erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    583d112 View commit details
    Browse the repository at this point in the history
  4. Fix implementation + first test

    svroonland authored and erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    f55c898 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    6f86958 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    9eb989b View commit details
    Browse the repository at this point in the history
  7. Formatting

    svroonland authored and erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    9a32c74 View commit details
    Browse the repository at this point in the history
  8. Fix doc

    svroonland authored and erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    98df970 View commit details
    Browse the repository at this point in the history
  9. Add test

    svroonland authored and erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    29f8e44 View commit details
    Browse the repository at this point in the history
  10. Tweak docs

    svroonland authored and erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    1215c43 View commit details
    Browse the repository at this point in the history
  11. Add test

    svroonland authored and erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    97d7e6f View commit details
    Browse the repository at this point in the history
  12. Move to separate file

    svroonland authored and erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    336aa8d View commit details
    Browse the repository at this point in the history
  13. runWithGracefulShutdown

    svroonland authored and erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    361cfec View commit details
    Browse the repository at this point in the history
  14. Add timeout

    svroonland authored and erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    4ee9696 View commit details
    Browse the repository at this point in the history
  15. Process PR comments

    svroonland authored and erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    dfa0afa View commit details
    Browse the repository at this point in the history
  16. Fix type constraints

    svroonland authored and erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    15ec438 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    885d9c9 View commit details
    Browse the repository at this point in the history
  18. Pause a partition when its stream is ended

    During a graceful shutdown the partition stream is ended. The runloop however, is still happily fetching records for that stream. These are then put in the stream's queue even though they will never be read. This is taking away network and CPU at a moment where the application should focus on doing a clean shutdown quickly. It could even cause an OOM for application that are tuned for the case where processing happens almost immediately.
    
    With this change, when a stream is ended:
    - the partition is paused,
    - already fetched new records are not added to the stream's queue.
    
    Also: less logging at start of a poll.
    erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    1408148 View commit details
    Browse the repository at this point in the history
  19. More tests

    svroonland authored and erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    ed326a2 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    252cc3a View commit details
    Browse the repository at this point in the history
  21. Fix race condition between join and timeout, leading to unwanted inte…

    …rruption of withStream
    svroonland authored and erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    9954dda View commit details
    Browse the repository at this point in the history
  22. Fix test

    svroonland authored and erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    add21e9 View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    8ec18c0 View commit details
    Browse the repository at this point in the history
  24. Update doc

    svroonland authored and erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    c409368 View commit details
    Browse the repository at this point in the history
  25. Cleanup

    svroonland authored and erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    2dbddfc View commit details
    Browse the repository at this point in the history
  26. Simplify subscribe

    svroonland authored and erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    7838929 View commit details
    Browse the repository at this point in the history
  27. requireRunning false

    svroonland authored and erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    c9e48ab View commit details
    Browse the repository at this point in the history
  28. Log unexpected interruption

    svroonland authored and erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    5d334e0 View commit details
    Browse the repository at this point in the history
  29. Log more

    svroonland authored and erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    60464b6 View commit details
    Browse the repository at this point in the history
  30. Use partitionedStream

    svroonland authored and erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    258168d View commit details
    Browse the repository at this point in the history
  31. Configuration menu
    Copy the full SHA
    6e25cd4 View commit details
    Browse the repository at this point in the history
  32. Formatting

    erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    8d19e16 View commit details
    Browse the repository at this point in the history
  33. Fix linting

    erikvanoosten committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    f1edcab View commit details
    Browse the repository at this point in the history

Commits on May 10, 2024

  1. Configuration menu
    Copy the full SHA
    f19417b View commit details
    Browse the repository at this point in the history

Commits on May 11, 2024

  1. Configuration menu
    Copy the full SHA
    5365aa0 View commit details
    Browse the repository at this point in the history

Commits on May 19, 2024

  1. Configuration menu
    Copy the full SHA
    f977001 View commit details
    Browse the repository at this point in the history

Commits on May 20, 2024

  1. This works

    svroonland committed May 20, 2024
    Configuration menu
    Copy the full SHA
    c54b3e9 View commit details
    Browse the repository at this point in the history
  2. This works with timeout

    svroonland committed May 20, 2024
    Configuration menu
    Copy the full SHA
    33a6d82 View commit details
    Browse the repository at this point in the history
  3. Remove unused annotation

    svroonland committed May 20, 2024
    Configuration menu
    Copy the full SHA
    a155267 View commit details
    Browse the repository at this point in the history

Commits on Jun 5, 2024

  1. Configuration menu
    Copy the full SHA
    15e041f View commit details
    Browse the repository at this point in the history

Commits on Jun 16, 2024

  1. Configuration menu
    Copy the full SHA
    7c21f82 View commit details
    Browse the repository at this point in the history

Commits on Jul 14, 2024

  1. Configuration menu
    Copy the full SHA
    f5e42c5 View commit details
    Browse the repository at this point in the history

Commits on Aug 10, 2024

  1. Small improvements to the Producer (#1272)

    By using ZIO.async, we no longer need a reference to the zio runtime,
    nor do we need the `exec` trickery anymore.
    erikvanoosten authored and svroonland committed Aug 10, 2024
    Configuration menu
    Copy the full SHA
    9a31569 View commit details
    Browse the repository at this point in the history
  2. Document metrics and consumer tuning based on metrics (#1280)

    Also: fix typo and make metric descriptions consistent.
    erikvanoosten authored and svroonland committed Aug 10, 2024
    Configuration menu
    Copy the full SHA
    27f033e View commit details
    Browse the repository at this point in the history
  3. Add alternative fetch strategy for many partitions (#1281)

    When many hundreds of partitions need to be consumed, an excessive
    amount of heap can be used for pre-fetching. The
    `ManyPartitionsQueueSizeBasedFetchStrategy` works similarly as the
    default `QueueSizeBasedFetchStrategy` but limits total memory usage.
    erikvanoosten authored and svroonland committed Aug 10, 2024
    Configuration menu
    Copy the full SHA
    108b285 View commit details
    Browse the repository at this point in the history
  4. Alternative producer implementation (#1285)

    Refactoring of the producer so that it handles errors per record.
    erikvanoosten authored and svroonland committed Aug 10, 2024
    Configuration menu
    Copy the full SHA
    eaae8af View commit details
    Browse the repository at this point in the history
  5. Prevent users from enabling auto commit (#1290)

    Zio-kafka applications always pre-fetch data so that user streams can
    process the data asynchronously. This is not compatible with auto
    commit. When auto commit is enabled, the consumer will automatically
    commit batches _before_ they are processed by the user streams.
    
    An unaware user might accidentally enable auto commit and lose data
    during rebalances.
    
    Solves #1289.
    erikvanoosten authored and svroonland committed Aug 10, 2024
    Configuration menu
    Copy the full SHA
    c862686 View commit details
    Browse the repository at this point in the history
  6. Update scalafmt-core to 3.8.3 (#1291)

    ## About this PR
    📦 Updates
    [org.scalameta:scalafmt-core](https://github.com/scalameta/scalafmt)
    from `3.8.2` to `3.8.3`
    
    📜 [GitHub Release
    Notes](https://github.com/scalameta/scalafmt/releases/tag/v3.8.3) -
    [Version
    Diff](scalameta/scalafmt@v3.8.2...v3.8.3)
    
    ## Usage
    ✅ **Please merge!**
    
    I'll automatically update this PR to resolve conflicts as long as you
    don't change it yourself.
    
    If you'd like to skip this version, you can just close this PR. If you
    have any feedback, just mention me in the comments below.
    
    Configure Scala Steward for your repository with a
    [`.scala-steward.conf`](https://github.com/scala-steward-org/scala-steward/blob/767fcfecbfd53c507152f6cf15c846176bae561d/docs/repo-specific-configuration.md)
    file.
    
    _Have a fantastic day writing Scala!_
    
    <details>
    <summary>⚙ Adjust future updates</summary>
    
    Add this to your `.scala-steward.conf` file to ignore future updates of
    this dependency:
    ```
    updates.ignore = [ { groupId = "org.scalameta", artifactId = "scalafmt-core" } ]
    ```
    Or, add this to slow down future updates of this dependency:
    ```
    dependencyOverrides = [{
      pullRequests = { frequency = "30 days" },
      dependency = { groupId = "org.scalameta", artifactId = "scalafmt-core" }
    }]
    ```
    </details>
    
    <sup>
    labels: library-update, early-semver-patch, semver-spec-patch,
    commit-count:1
    </sup>
    
    Co-authored-by: zio-scala-steward[bot] <145262613+zio-scala-steward[bot]@users.noreply.github.com>
    zio-scala-steward[bot] authored and svroonland committed Aug 10, 2024
    Configuration menu
    Copy the full SHA
    ff4ea7f View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    bbbfe48 View commit details
    Browse the repository at this point in the history
  8. Add sonatype snapshots

    svroonland committed Aug 10, 2024
    Configuration menu
    Copy the full SHA
    a75a78e View commit details
    Browse the repository at this point in the history

Commits on Oct 10, 2024

  1. Bump ZIO version

    svroonland committed Oct 10, 2024
    Configuration menu
    Copy the full SHA
    5fec195 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    699e6e8 View commit details
    Browse the repository at this point in the history
  3. Revert stuff

    svroonland committed Oct 10, 2024
    Configuration menu
    Copy the full SHA
    aafd4ec View commit details
    Browse the repository at this point in the history

Commits on Oct 20, 2024

  1. Bump

    svroonland committed Oct 20, 2024
    Configuration menu
    Copy the full SHA
    34f5110 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    95f9bef View commit details
    Browse the repository at this point in the history

Commits on Nov 2, 2024

  1. Configuration menu
    Copy the full SHA
    f33dc34 View commit details
    Browse the repository at this point in the history
  2. Tweak

    svroonland committed Nov 2, 2024
    Configuration menu
    Copy the full SHA
    3cb1eee View commit details
    Browse the repository at this point in the history
  3. Tweak

    svroonland committed Nov 2, 2024
    Configuration menu
    Copy the full SHA
    87eadd8 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    31cd086 View commit details
    Browse the repository at this point in the history
  5. Increase timeout

    svroonland committed Nov 2, 2024
    Configuration menu
    Copy the full SHA
    a6d2afa View commit details
    Browse the repository at this point in the history
  6. This seems to work

    svroonland committed Nov 2, 2024
    Configuration menu
    Copy the full SHA
    1835758 View commit details
    Browse the repository at this point in the history
  7. Cleanup

    svroonland committed Nov 2, 2024
    Configuration menu
    Copy the full SHA
    6c28b89 View commit details
    Browse the repository at this point in the history
  8. Cleanup

    svroonland committed Nov 2, 2024
    Configuration menu
    Copy the full SHA
    e649753 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    348b01e View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    c9f1597 View commit details
    Browse the repository at this point in the history
  11. More renames

    svroonland committed Nov 2, 2024
    Configuration menu
    Copy the full SHA
    4a9b6f6 View commit details
    Browse the repository at this point in the history
  12. Fix rebalanceSafeCommits test timing out

    After consumer 1 is shutdown (using stopConsumption), rebalances happen and partitions from consumer 2 are assigned. These streams are never started, so the finalizer completing completedPromise is never called. Waiting for these to complete takes 3 minutes (default maxRebalanceDuration).
    
    In case that streams were assigned and no record was ever put in their queues, there's no need to wait for the stream to complete.
    svroonland committed Nov 2, 2024
    Configuration menu
    Copy the full SHA
    3c0cfd1 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    90ca347 View commit details
    Browse the repository at this point in the history
  14. Fix shutdown behavior

    svroonland committed Nov 2, 2024
    Configuration menu
    Copy the full SHA
    edb7005 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    e400012 View commit details
    Browse the repository at this point in the history
  16. Apply suggestions from code review

    Co-authored-by: Erik van Oosten <[email protected]>
    svroonland and erikvanoosten authored Nov 2, 2024
    Configuration menu
    Copy the full SHA
    e83bc89 View commit details
    Browse the repository at this point in the history
  17. Restore stuff

    svroonland committed Nov 2, 2024
    Configuration menu
    Copy the full SHA
    efd3937 View commit details
    Browse the repository at this point in the history
  18. Cleanup

    svroonland committed Nov 2, 2024
    Configuration menu
    Copy the full SHA
    e29d63e View commit details
    Browse the repository at this point in the history

Commits on Nov 3, 2024

  1. Update docs/consuming-kafka-topics-using-zio-streams.md

    Co-authored-by: Erik van Oosten <[email protected]>
    svroonland and erikvanoosten authored Nov 3, 2024
    Configuration menu
    Copy the full SHA
    f19f90d View commit details
    Browse the repository at this point in the history
  2. PR comments

    svroonland committed Nov 3, 2024
    Configuration menu
    Copy the full SHA
    c71a08f View commit details
    Browse the repository at this point in the history

Commits on Nov 5, 2024

  1. Configuration menu
    Copy the full SHA
    5c27da7 View commit details
    Browse the repository at this point in the history
  2. Revert change

    This caused the "process outstanding commits after a graceful shutdown with aggregateAsync using `maxRebalanceDuration`" to fail.
    svroonland committed Nov 5, 2024
    Configuration menu
    Copy the full SHA
    9901b16 View commit details
    Browse the repository at this point in the history

Commits on Nov 9, 2024

  1. Configuration menu
    Copy the full SHA
    a9925d5 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    dac1865 View commit details
    Browse the repository at this point in the history
  3. Stronger test

    svroonland committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    ddbd576 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8e461ee View commit details
    Browse the repository at this point in the history
  5. Fix interruption issue

    svroonland committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    5848e9c View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    143f914 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    d5fc7bb View commit details
    Browse the repository at this point in the history
  8. Fix doc syntax

    svroonland committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    d6f485c View commit details
    Browse the repository at this point in the history
  9. Fix test

    svroonland committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    5ef97ef View commit details
    Browse the repository at this point in the history

Commits on Nov 10, 2024

  1. Update comment

    svroonland committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    bec0e25 View commit details
    Browse the repository at this point in the history