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 iter may not be Released in some cases #722

Merged
merged 4 commits into from
Aug 22, 2019

Conversation

zier-one
Copy link
Contributor

What problem does this PR solve?

When error happened in loop, iter may not be released. And when l0Num >= l0Trigger, we better release the iter, it may be affect compaction operation.

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Code changes

  • Has exported function/method change
  • Has exported variable/fields change
  • Has interface methods change
  • Has persistent data change

Side effects

  • Possible performance regression
  • Increased code complexity
  • Breaking backward compatibility

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation
  • Need to update the tidb-ansible repository
  • Need to be included in the release note

@zier-one
Copy link
Contributor Author

/run-all-tests

Copy link
Contributor

@july2993 july2993 left a comment

Choose a reason for hiding this comment

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

LGTM
A not release iter will not affect compaction, but the files it references will not be deleted even it's compacted. Because the iter creates a snapshot to get a consistent view of data, once it's released and the reference count of the file drop to be 0 the file will be delete.

Besides goleveldb use runtime.SetFinalizer to make sure the Release() will be called...so even in the error case it will be Release finally.

Copy link
Contributor

@july2993 july2993 left a comment

Choose a reason for hiding this comment

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

LGTM

@zier-one zier-one requested a review from suzaku August 22, 2019 02:33
@zier-one
Copy link
Contributor Author

@suzaku PTAL

Copy link
Contributor

@suzaku suzaku left a comment

Choose a reason for hiding this comment

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

Rest LGTM.

pump/storage/storage.go Outdated Show resolved Hide resolved
Co-Authored-By: satoru <satorulogic@gmail.com>
@zier-one
Copy link
Contributor Author

/run-all-tests

@zier-one
Copy link
Contributor Author

/run-all-tests

Copy link
Contributor

@suzaku suzaku left a comment

Choose a reason for hiding this comment

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

LGTM

@zier-one zier-one merged commit 8df45da into pingcap:master Aug 22, 2019
@zier-one zier-one deleted the fix_iter branch August 22, 2019 08:00
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.

3 participants