Skip to content

[improve] configure whether function consumer should skip to latest#17214

Merged
nlu90 merged 4 commits into
apache:masterfrom
streamnative:neng/function-consume-skip-to-latest
Feb 24, 2023
Merged

[improve] configure whether function consumer should skip to latest#17214
nlu90 merged 4 commits into
apache:masterfrom
streamnative:neng/function-consume-skip-to-latest

Conversation

@nlu90

@nlu90 nlu90 commented Aug 22, 2022

Copy link
Copy Markdown
Member

(If this PR fixes a github issue, please add Fixes #<xyz>.)

Fixes #

(or if this PR is one task of a github issue, please add Master Issue: #<xyz> to link to the master issue.)

Master Issue: #

Motivation

In certain failure cases, the function needs to skip all the content between the last successfully Acked message and the latest message in the topic in order for quick recovery.

Modifications

  1. Providing a boolean config for function submission cmd
  2. PulsarSource will call consumer.seek(MessageId.latest) if the skip flag is set

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

Does this pull request potentially affect one of the following parts:

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): (yes / no)
  • The public API: (yes / no)
  • The schema: (yes / no / don't know)
  • The default values of configurations: (yes / no)
  • The wire protocol: (yes / no)
  • The rest endpoints: (yes / no)
  • The admin cli options: (yes / no)
  • Anything that affects deployment: (yes / no / don't know)

Documentation

Check the box below or label this PR directly.

Need to update docs?

  • doc-required
    (Your PR needs to update docs and you will update later)

  • doc-not-needed
    (Please explain why)

  • doc
    (Your PR contains doc changes)

  • doc-complete
    (Docs have been already added)

@github-actions github-actions Bot added the doc-required Your PR changes impact docs and you will update later. label Aug 22, 2022
@nlu90 nlu90 force-pushed the neng/function-consume-skip-to-latest branch from 0ebc332 to 3e3aa03 Compare August 22, 2022 23:13
@nlu90 nlu90 requested review from freeznet and liudezhi2098 August 22, 2022 23:19
@liudezhi2098

Copy link
Copy Markdown
Contributor

/pulsarbot run-failure-checks

@github-actions

github-actions Bot commented Nov 8, 2022

Copy link
Copy Markdown

The pr had no activity for 30 days, mark with Stale label.

@github-actions github-actions Bot added the Stale label Nov 8, 2022
@liudezhi2098

Copy link
Copy Markdown
Contributor

@nlu90 help handle Conflicting files.

@github-actions github-actions Bot removed the Stale label Nov 12, 2022
@github-actions

Copy link
Copy Markdown

The pr had no activity for 30 days, mark with Stale label.

@github-actions github-actions Bot added the Stale label Dec 13, 2022
@nlu90

nlu90 commented Jan 30, 2023

Copy link
Copy Markdown
Member Author

/pulsarbot run-failure-checks

@github-actions github-actions Bot removed the Stale label Jan 31, 2023
@codelipenghui codelipenghui added this to the 3.0.0 milestone Feb 7, 2023
@codelipenghui codelipenghui reopened this Feb 7, 2023
@nlu90 nlu90 changed the title [WIP] configure whether function consumer should skip to latest [feat] configure whether function consumer should skip to latest Feb 7, 2023
@nlu90 nlu90 changed the title [feat] configure whether function consumer should skip to latest [improve] configure whether function consumer should skip to latest Feb 7, 2023
@codecov-commenter

codecov-commenter commented Feb 7, 2023

Copy link
Copy Markdown

Codecov Report

Merging #17214 (a94a2b2) into master (644be5f) will increase coverage by 28.98%.
The diff coverage is 35.71%.

Impacted file tree graph

@@              Coverage Diff              @@
##             master   #17214       +/-   ##
=============================================
+ Coverage     32.42%   61.40%   +28.98%     
- Complexity     6347    23020    +16673     
=============================================
  Files          1644     1833      +189     
  Lines        123712   143586    +19874     
  Branches      13486    16890     +3404     
=============================================
+ Hits          40109    88170    +48061     
+ Misses        77694    47233    -30461     
- Partials       5909     8183     +2274     
Flag Coverage Δ
inttests 26.39% <0.00%> (+1.45%) ⬆️
systests 26.74% <35.71%> (+1.08%) ⬆️
unittests 57.85% <21.42%> (+40.31%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...java/org/apache/pulsar/admin/cli/CmdFunctions.java 47.45% <0.00%> (+47.45%) ⬆️
...ar/functions/source/MultiConsumerPulsarSource.java 89.47% <0.00%> (-2.20%) ⬇️
...r/functions/source/SingleConsumerPulsarSource.java 93.33% <0.00%> (+4.04%) ⬆️
...he/pulsar/functions/utils/FunctionConfigUtils.java 62.87% <33.33%> (+22.58%) ⬆️
...apache/pulsar/common/functions/FunctionConfig.java 96.42% <100.00%> (+0.06%) ⬆️
...ulsar/functions/instance/JavaInstanceRunnable.java 54.63% <100.00%> (+0.38%) ⬆️
...he/pulsar/functions/source/PulsarSourceConfig.java 81.81% <100.00%> (+1.81%) ⬆️
...r/metadata/api/extended/MetadataStoreExtended.java 40.00% <0.00%> (-10.00%) ⬇️
...ce/ConsistentHashingStickyKeyConsumerSelector.java 76.92% <0.00%> (-3.85%) ⬇️
.../apache/pulsar/client/impl/TopicMessageIdImpl.java 82.60% <0.00%> (-2.01%) ⬇️
... and 1231 more

@nlu90 nlu90 merged commit bf982f4 into apache:master Feb 24, 2023
bool cleanupSubscription = 11;
SubscriptionPosition subscriptionPosition = 12;
uint64 negativeAckRedeliveryDelayMs = 13;
bool skipToLatest = 14;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@nlu90 - was this discussed on the mailing list? This is a protobuf change. We have a general rule that those go through the PIP process. While there could be exceptions, we should always post about these kinds of changes on the mailing list.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@michaeljmarshall As we discussed via slack, I'll email the mailing list about the function proto change.
But it should be backward compatible and won't cause any issue for previous users.

@momo-jun

Copy link
Copy Markdown
Contributor

Hi @nlu90, I'm checking in to follow up with the doc updates. Did you have any plans to update the docs?

michaeljmarshall added a commit to michaeljmarshall/pulsar that referenced this pull request Feb 27, 2023
@nlu90

nlu90 commented Feb 27, 2023

Copy link
Copy Markdown
Member Author

Hi @nlu90, I'm checking in to follow up with the doc updates. Did you have any plans to update the docs?

@momo-jun Let me know where I can update the docs.

@momo-jun

Copy link
Copy Markdown
Contributor

@nlu90 shall we add skipToLatest to here? Maybe @freeznet @liudezhi2098 can also advise.
BTW, the pulsar docs have been moved to the site repo.

@codelipenghui codelipenghui deleted the neng/function-consume-skip-to-latest branch March 14, 2023 00:34
@momo-jun momo-jun added doc-complete Your PR changes impact docs and the related docs have been already added. and removed doc-required Your PR changes impact docs and you will update later. labels Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-complete Your PR changes impact docs and the related docs have been already added.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants