-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
[LEDGER] move couchdb util package to statecouchdb package #926
Conversation
core/ledger/kvledger/txmgmt/statedb/statecouchdb/statecouchdb_test_export.go
Outdated
Show resolved
Hide resolved
gossip UT flake |
/ci-run |
AZP build triggered! |
core/ledger/kvledger/txmgmt/privacyenabledstate/test_exports.go
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments on the changes in your last change-set
core/ledger/kvledger/txmgmt/statedb/statecouchdb/statecouchdb_test_export.go
Outdated
Show resolved
Hide resolved
core/ledger/kvledger/txmgmt/statedb/statecouchdb/statecouchdb_test_export.go
Outdated
Show resolved
Hide resolved
core/ledger/kvledger/txmgmt/statedb/statecouchdb/couchdb_test.go
Outdated
Show resolved
Hide resolved
core/ledger/kvledger/txmgmt/statedb/statecouchdb/couchdb_test.go
Outdated
Show resolved
Hide resolved
Yes, Manish. I catched all your points already and that's why I made it WIP. Will be done by today. |
Yes, My fault. I noticed WIP tag, after submitting the comments |
8dc4456
to
17b78a7
Compare
@ryjones I have a question as you asked me to squash my commits to one. Do we have this squash and merge feature? https://blog.pairworking.com/why-you-should-care-about-squash-and-merge-in-git-675856bf66b0 If it is so, I will push multiple commits per PRs as it would enable the reviewer to easily look at changes made between two reviews. Otherwise, the reviewer's job would be painful to go over all files. During the merge, they can squash and merge. @manish-sethi also feels that it is hard to review without seeing the diff between the base commit and new commits which made changes to code as per the suggestions. |
@cendhu - We can still see the diffs even if you push as a single commit. The problem is when you rebase in between |
Conflicts are resolved. @manish-sethi let's get this in. This PR is too boring now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM. Just one comment on what you changed in the last patch
core/ledger/kvledger/txmgmt/statedb/statecouchdb/statecouchdb_test_export.go
Outdated
Show resolved
Hide resolved
core/ledger/kvledger/txmgmt/statedb/statecouchdb/statecouchdb_test_export.go
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have addressed the review comments. I have pushed multiple commits so that the changes can be seen easily.
core/ledger/kvledger/txmgmt/statedb/statecouchdb/statecouchdb_test_export.go
Outdated
Show resolved
Hide resolved
core/ledger/kvledger/txmgmt/statedb/statecouchdb/statecouchdb_test_export.go
Outdated
Show resolved
Hide resolved
462a0d0
to
78111cb
Compare
rebased and fixed conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, mostly cleanup related comments.
core/ledger/kvledger/txmgmt/statedb/statecouchdb/statecouchdb_test.go
Outdated
Show resolved
Hide resolved
core/ledger/kvledger/txmgmt/statedb/statecouchdb/statecouchdb_test.go
Outdated
Show resolved
Hide resolved
core/ledger/kvledger/txmgmt/statedb/statecouchdb/statecouchdb_test.go
Outdated
Show resolved
Hide resolved
core/ledger/kvledger/txmgmt/statedb/statecouchdb/couchdb_test.go
Outdated
Show resolved
Hide resolved
@cendhu - LGTM now. You can squash and make it a single commit and we can merge now. Only one pending comment is there. If you want to address that while making it as a single commit, that would be good. But I am fine merging otherwise as well. |
We have a CouchDB util package that exposes API to read from and write to CouchDB. This package is used only by the statecouchdb and the tests package (i.e., ledger level integration test). In general, a util package is justified only when an API needs to be used by so many other packages. For e.g., if we have 10 packages and each of them need a common API, it is not good to duplicate the API code and instead create a separate util package. Hence, we move all files in the CouchDB util package to the statecouchdb package itself. Note that there is a lot of opportunities to refactor couchdb package but we will do that in a separate PR. Given that we have moved couchdb util to the statecouchdb package, we can have only one TestMain. It would be hacky to reuse existing testVDBEnv for testing couchDB too. Hence, we introduce another testEnv called testCouchDBEnv to test couchDB utils. Signed-off-by: senthil <cendhu@gmail.com>
Squashed all 3 commits to a single commit. |
Type of change
Description
We have a CouchDB util package that exposes API to read from and write to CouchDB. This package is used only by the statecouchdb and the tests package (i.e., ledger level integration test).
In general, a util package is justified only when an API needs to be used by so many other packages. For e.g., if we have 10 packages and each of them need a common API, it is not good to duplicate the API code. Hence, it is good to create a separate util package. One such example can be found in the volume folder in the Kubernetes repo – It can be seen that Kubernetes supports 26 different volume types and hence a util package to hold common APIs is justified. However, in our case, it is not justified to have a separate util package to facilitate CouchDB access.
Hence, we move all files in the CouchDB util package to the statecouchdb package itself. Note that there is a lot of opportunities to refactor the CouchDB util package but we would do it in a separate JIRA.
Additional details
Before starting the ledger checkpointing code, we would like to refactor the ledger package. If we continue to add new features with the current package structure, after a few years, it will be unmaintainable. We plan to have nearly 10 such PRs. Note that each PR may modify many files and we cannot do much about it. We might be okay to get some review burden than having an unmaintainable code in the longer term.
Related issues
FAB-17667