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

Avoid repeated called of NewIterator which might be slow #718

Merged
merged 5 commits into from
Aug 20, 2019

Conversation

zier-one
Copy link
Contributor

@zier-one zier-one commented Aug 16, 2019

What problem does this PR solve?

When the size of metadata(storage with leveldb) grown very large, pump storage gc will be very slowly. The reason for this bug is the seek operation in goleveldb spend too much time.

What is changed and how it works?

we seek only one time on the init process of GC, instead of seek every time before vlog gc.

Check List

Tests

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

@july2993
Copy link
Contributor

/run-all-tests

@july2993
Copy link
Contributor

july2993 commented Aug 19, 2019

any more detail about why it will be so slow, will it be relate to because too many key with same
key encodeTSKey(0)(too many version) ?

will db.Get(key) cost so long too?

@july2993
Copy link
Contributor

what about adding a metrics about deleted keys number?, so we can know the delete speed later from metrics.

@zier-one
Copy link
Contributor Author

/run-all-tests

@zier-one
Copy link
Contributor Author

@july2993 @suzaku PTAL

@zier-one
Copy link
Contributor Author

any more detail about why it will be so slow, will it be relate to because too many key with same
key encodeTSKey(0)(too many version) ?

will db.Get(key) cost so long too?

I will go deep into this problem and find the answer to those.

@zier-one
Copy link
Contributor Author

/run-all-tests

pump/storage/metrics.go Outdated Show resolved Hide resolved
pump/storage/metrics.go Outdated Show resolved Hide resolved
@zier-one
Copy link
Contributor Author

/run-all-tests

pump/storage/storage.go Outdated Show resolved Hide resolved
pump/storage/storage.go Outdated Show resolved Hide resolved
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
Copy link
Contributor Author

@july2993 PTAL again

@suzaku
Copy link
Contributor

suzaku commented Aug 19, 2019

@leoppro You may consider changing the commit message to "Avoid repeated called of NewIterator which might be slow" before merging.

@zier-one zier-one changed the title storage: fix drawling gc when metadata size is very big Avoid repeated called of NewIterator which might be slow Aug 19, 2019
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.

rest LGTM

pump/storage/metrics.go Outdated Show resolved Hide resolved
pump/storage/metrics.go Outdated Show resolved Hide resolved
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 merged commit 4f4bfef into pingcap:master Aug 20, 2019
@zier-one zier-one deleted the fix_1481 branch August 20, 2019 03:01
zier-one pushed a commit to zier-one/tidb-binlog that referenced this pull request Aug 20, 2019
zier-one pushed a commit to zier-one/tidb-binlog that referenced this pull request Aug 22, 2019
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