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

[cleanup] [broker] fix return value of TransactionTimeoutTrackerImpl#addTransaction #22020

Merged

Conversation

thetumbled
Copy link
Member

@thetumbled thetumbled commented Feb 4, 2024

Motivation

According to the method signature, we should return true when the transaction is added to the tracker.

    /**
     * Add a txnID to the tracker.
     *
     * @param sequenceId
     *            the sequenceId
     * @param timeout
     *            the absolute timestamp for transaction timeout
     *
     * @return true if the transaction was added to the tracker or false if had timed out
     */
    CompletableFuture<Boolean> addTransaction(long sequenceId, long timeout);

But actually, we return false for any cases.

Update: Moreover, we do not use the return value anyway, it is useless. We have better remove it.

Modifications

Return true when the transaction is added to the tracker.
Remove the return value as it is useless.

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.

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

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: thetumbled#41

@liangyepianzhou
Copy link
Contributor

Hi, @thetumbled Thanks for this catch.
IMO, It is better to delete the return value.

@thetumbled
Copy link
Member Author

/pulsarbot rerun-failure-checks

@codecov-commenter
Copy link

codecov-commenter commented Feb 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e7c2a75) 73.73% compared to head (86d1d75) 73.66%.
Report is 3 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #22020      +/-   ##
============================================
- Coverage     73.73%   73.66%   -0.08%     
+ Complexity    32536    32500      -36     
============================================
  Files          1863     1863              
  Lines        138816   138820       +4     
  Branches      15217    15219       +2     
============================================
- Hits         102356   102257      -99     
- Misses        28589    28667      +78     
- Partials       7871     7896      +25     
Flag Coverage Δ
inttests 24.11% <0.00%> (-0.12%) ⬇️
systests 23.90% <0.00%> (-0.17%) ⬇️
unittests 72.93% <100.00%> (-0.07%) ⬇️

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

Files Coverage Δ
...saction/timeout/TransactionTimeoutTrackerImpl.java 96.49% <100.00%> (ø)

... and 76 files with indirect coverage changes

@Technoboy-
Copy link
Contributor

Hi, @thetumbled Thanks for this catch. IMO, It is better to delete the return value.

This method has existed since 2.8. We can't change this without discussion.

@liangyepianzhou
Copy link
Contributor

This method has existed since 2.8. We can't change this without discussion.

I agree. Even though this is a Beta interface, it has been around for too long. We can start a discussion.

@thetumbled
Copy link
Member Author

@poorbarcode
Copy link
Contributor

According to the method signature, we should return true when the transaction is added to the tracker.

    /**
     * Add a txnID to the tracker.
     *
     * @param sequenced
     *            the sequenced
     * @param timeout
     *            the absolute timestamp for transaction timeout
     *
     * @return true if the transaction was added to the tracker or false if had timed out
     */
    CompletableFuture<Boolean> addTransaction(long sequenceId, long timeout);

But actually, we return false for any cases.

You changed the definition to void addTransation(), it is not matches with the Motivation, please correct it.

@poorbarcode poorbarcode changed the title [fix] [broker] fix return value of TransactionTimeoutTrackerImpl#addTransaction [cleanup] [broker] fix return value of TransactionTimeoutTrackerImpl#addTransaction Feb 5, 2024
@thetumbled
Copy link
Member Author

According to the method signature, we should return true when the transaction is added to the tracker.

    /**
     * Add a txnID to the tracker.
     *
     * @param sequenced
     *            the sequenced
     * @param timeout
     *            the absolute timestamp for transaction timeout
     *
     * @return true if the transaction was added to the tracker or false if had timed out
     */
    CompletableFuture<Boolean> addTransaction(long sequenceId, long timeout);

But actually, we return false for any cases.

You changed the definition to void addTransation(), it is not matches with the Motivation, please correct it.

Updated, thanks.

@thetumbled thetumbled closed this Feb 6, 2024
@thetumbled thetumbled reopened this Feb 6, 2024
@liangyepianzhou liangyepianzhou merged commit 0dabc97 into apache:master Feb 6, 2024
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-not-needed Your PR changes do not impact docs ready-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants