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

Rectify DB debug APIs chaindbProperty and chaindbCompact #2062

Merged
merged 7 commits into from Jan 16, 2024

Conversation

hyunsooda
Copy link
Contributor

@hyunsooda hyunsooda commented Dec 8, 2023

Proposed changes

Fixed non-functional legacy LevelDB only APIs (debug.chaindbProperty and debug.chaindbCompact). I'll appreciate it if you give an idea to refactor the ugly dummy to a succinct style in shardedDB.

  1. debug.chaindbProperty(<property>)
> debug.chaindbProperty("")
  [misc:LevelDB]
Compactions
 Level |   Tables   |    Size(MB)   |    Time(sec)  |    Read(MB)   |   Write(MB)
-------+------------+---------------+---------------+---------------+---------------
   0   |          2 |      13.83005 |       0.21498 |       0.00000 |      34.55984
   1   |         36 |      73.81695 |       0.71184 |      90.47719 |      73.81695
-------+------------+---------------+---------------+---------------+---------------
 Total |         38 |      87.64700 |       0.92682 |      90.47719 |     108.37680
 [header:LevelDB]
Compactions
 Level |   Tables   |    Size(MB)   |    Time(sec)  |    Read(MB)   |   Write(MB)
-------+------------+---------------+---------------+---------------+---------------
   0   |          1 |      18.92433 |       0.56948 |       0.00000 |     151.40663
   1   |         51 |      98.75594 |       0.79978 |     183.49827 |     170.02713
   2   |        419 |     846.74403 |       0.00000 |       0.00000 |       0.00000
-------+------------+---------------+---------------+---------------+---------------
 Total |        471 |     964.42430 |       1.36926 |     183.49827 |     321.43376
 [body:LevelDB]
Compactions
 Level |   Tables   |    Size(MB)   |    Time(sec)  |    Read(MB)   |   Write(MB)
-------+------------+---------------+---------------+---------------+---------------
   1   |          9 |      21.44867 |       0.00000 |       0.00000 |       0.00000
-------+------------+---------------+---------------+---------------+---------------
 Total |          9 |      21.44867 |       0.00000 |       0.00000 |       0.00000
 [receipts:LevelDB]
Compactions
 Level |   Tables   |    Size(MB)   |    Time(sec)  |    Read(MB)   |   Write(MB)
-------+------------+---------------+---------------+---------------+---------------
   1   |          9 |      20.70702 |       0.00000 |       0.00000 |       0.00000
-------+------------+---------------+---------------+---------------+---------------
 Total |          9 |      20.70702 |       0.00000 |       0.00000 |       0.00000
 [statetrie:ShardedDB]
 [shrad0:LevelDB]
Compactions
 Level |   Tables   |    Size(MB)   |    Time(sec)  |    Read(MB)   |   Write(MB)
-------+------------+---------------+---------------+---------------+---------------
   1   |          3 |       5.61462 |       0.00000 |       0.00000 |       0.00000
-------+------------+---------------+---------------+---------------+---------------
 Total |          3 |       5.61462 |       0.00000 |       0.00000 |       0.00000
 [shrad1:LevelDB]
Compactions
 Level |   Tables   |    Size(MB)   |    Time(sec)  |    Read(MB)   |   Write(MB)
-------+------------+---------------+---------------+---------------+---------------
   1   |          3 |       5.54748 |       0.00000 |       0.00000 |       0.00000
-------+------------+---------------+---------------+---------------+---------------
 Total |          3 |       5.54748 |       0.00000 |       0.00000 |       0.00000
 [shrad2:LevelDB]
Compactions
 Level |   Tables   |    Size(MB)   |    Time(sec)  |    Read(MB)   |   Write(MB)
-------+------------+---------------+---------------+---------------+---------------
   1   |          3 |       5.63084 |       0.00000 |       0.00000 |       0.00000
-------+------------+---------------+---------------+---------------+---------------
 Total |          3 |       5.63084 |       0.00000 |       0.00000 |       0.00000
 [shrad3:LevelDB]
Compactions
 Level |   Tables   |    Size(MB)   |    Time(sec)  |    Read(MB)   |   Write(MB)
-------+------------+---------------+---------------+---------------+---------------
   1   |          4 |       6.97252 |       0.00000 |       0.00000 |       0.00000
-------+------------+---------------+---------------+---------------+---------------
 Total |          4 |       6.97252 |       0.00000 |       0.00000 |       0.00000
 [txlookup:LevelDB]
Compactions
 Level |   Tables   |    Size(MB)   |    Time(sec)  |    Read(MB)   |   Write(MB)
-------+------------+---------------+---------------+---------------+---------------
   1   |          1 |       0.10515 |       0.00000 |       0.00000 |       0.00000
-------+------------+---------------+---------------+---------------+---------------
 Total |          1 |       0.10515 |       0.00000 |       0.00000 |       0.00000
 [bridgeservice:LevelDB]
Compactions
 Level |   Tables   |    Size(MB)   |    Time(sec)  |    Read(MB)   |   Write(MB)
-------+------------+---------------+---------------+---------------+---------------
-------+------------+---------------+---------------+---------------+---------------
 Total |          0 |       0.00000 |       0.00000 |       0.00000 |       0.00000
 [snapshot:LevelDB]
Compactions
 Level |   Tables   |    Size(MB)   |    Time(sec)  |    Read(MB)   |   Write(MB)
-------+------------+---------------+---------------+---------------+---------------
-------+------------+---------------+---------------+---------------+---------------
 Total |          0 |       0.00000 |       0.00000 |       0.00000 |       0.00000

null

  1. debug.chaindbCompact() manually compacts ldb files.
> debug.chaindbCompact()
> null

Check out the reduced number of ldb files.

  1. Removed debug.getDBProperty in favor of debug.chaindbProperty.

Types of changes

Please put an x in the boxes related to your change.

  • Bugfix
  • New feature or enhancement
  • Others

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING GUIDELINES doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes ($ make test)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Related issues

  • Please leave the issue numbers or links related to this PR here.

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

@blukat29 blukat29 added do not merge don't merge this PR yet and removed do not merge don't merge this PR yet labels Dec 8, 2023
@hyunsooda hyunsooda self-assigned this Dec 19, 2023
storage/database/db_manager.go Show resolved Hide resolved
storage/database/db_manager.go Outdated Show resolved Hide resolved
@hyunsooda
Copy link
Contributor Author

hyunsooda commented Dec 20, 2023

@blukat29, Removed debug.getDBProperty and debug.chaindbProperty subsumes the information of the removed API.

blukat29
blukat29 previously approved these changes Dec 20, 2023
@blukat29
Copy link
Contributor

PTAL @jeongkyun-oh. We're changing the API you've added.

@blukat29 blukat29 changed the title [API] Rectified non-functional legacy LevelDB APIs Rectify DB debug APIs chaindbProperty and chaindbCompact Dec 20, 2023
api/api_private_debug.go Outdated Show resolved Hide resolved
storage/database/sharded_database.go Outdated Show resolved Hide resolved
jeongkyun-oh
jeongkyun-oh previously approved these changes Jan 9, 2024
@jeongkyun-oh
Copy link
Contributor

@blukat29 The added API debug.getDBProperty is used for debugging purpose. It can be removed.

@hyunsooda hyunsooda dismissed stale reviews from jeongkyun-oh and blukat29 via 7f09a63 January 10, 2024 01:15
@hyunsooda hyunsooda merged commit c53378d into klaytn:dev Jan 16, 2024
11 checks passed
@blukat29 blukat29 mentioned this pull request Jan 22, 2024
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants