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][test] Catch exception when update data in mockZookeeper #16473

Merged
merged 3 commits into from
Jul 12, 2022
Merged

[fix][test] Catch exception when update data in mockZookeeper #16473

merged 3 commits into from
Jul 12, 2022

Conversation

mattisonchao
Copy link
Member

@mattisonchao mattisonchao commented Jul 8, 2022

Motivation

Catch exception when updating data in mockZookeeper. this problem looks like #15755

And move lock() into try/catch block in case of throwing exception from the lock.

public void lock() {
if (acquired.compareAndSet(false, true)) {
lock.lock();
} else {
throw new IllegalStateException("Lock was already acquired!");
}
}
public void unlockIfNeeded() {
if (acquired.compareAndSet(true, false)) {
lock.unlock();
}
}
}

Also fix #16483

Modifications

  • Add catch for MockZookeeper.

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)

@mattisonchao mattisonchao changed the title [Don't Merge] Test master branch test. [fix][test] Catch exception when update data in mockZookeeper Jul 8, 2022
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jul 8, 2022
@mattisonchao
Copy link
Member Author

mattisonchao commented Jul 8, 2022

The mockZookeeper lock may have some problems; we still need to follow up on it in another PR.

@mattisonchao mattisonchao self-assigned this Jul 8, 2022
@mattisonchao mattisonchao added this to the 2.11.0 milestone Jul 8, 2022
@Technoboy- Technoboy- closed this Jul 8, 2022
@Technoboy- Technoboy- reopened this Jul 8, 2022
@Technoboy- Technoboy- closed this Jul 8, 2022
@Technoboy- Technoboy- reopened this Jul 8, 2022
@Technoboy- Technoboy- closed this Jul 9, 2022
@Technoboy- Technoboy- reopened this Jul 9, 2022
Copy link
Contributor

@Technoboy- Technoboy- left a comment

Choose a reason for hiding this comment

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

  1. Change line- 991 to Throwable.
  2. Missing to update exists method.

Copy link
Contributor

@nicoloboschi nicoloboschi left a comment

Choose a reason for hiding this comment

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

nice work!
please revert the non related part

build/run_unit_group.sh Outdated Show resolved Hide resolved
pom.xml Outdated Show resolved Hide resolved
@Technoboy- Technoboy- removed doc-not-needed Your PR changes do not impact docs labels Jul 12, 2022
@Technoboy- Technoboy- added doc-not-needed Your PR changes do not impact docs labels Jul 12, 2022
@Technoboy- Technoboy- merged commit 4df2593 into apache:master Jul 12, 2022
wuxuanqicn pushed a commit to wuxuanqicn/pulsar that referenced this pull request Jul 14, 2022
codelipenghui pushed a commit that referenced this pull request Jul 15, 2022
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Jul 19, 2022
congbobo184 pushed a commit that referenced this pull request Nov 10, 2022
@congbobo184 congbobo184 added the cherry-picked/branch-2.9 Archived: 2.9 is end of life label Nov 10, 2022
congbobo184 pushed a commit that referenced this pull request Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flaky-test: PulsarFunctionTlsTest.tearDown
5 participants