-
Notifications
You must be signed in to change notification settings - Fork 381
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
added/updated postgresql implementation of log_storage #1571
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1571 +/- ##
==========================================
+ Coverage 66.89% 67.71% +0.82%
==========================================
Files 110 111 +1
Lines 8946 9529 +583
==========================================
+ Hits 5984 6453 +469
- Misses 2358 2383 +25
- Partials 604 693 +89
Continue to review full report at Codecov.
|
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.
Could you add test coverage please?
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.
Thanks for sending this!
A few comments from a quick pass over.
…abase via test code
The CI keeps failing on a goimports failure on a file I didn't edit. Can anyone offer advice on what's going on? |
You can just run the |
I absolutely agree that goimports should fix this issue. I don't think we're working with the same version. When I run goimports on an old version of the file, I get:
It seems to loathe the tabs and wants spaces. However, when I run it on the file that autobuild is complaining about, I get no response:
Indicating, to me, at least that the code is fine. However, the build version of the formatter does not agree; even after removing the tabs. I have been able to get further by deleting the comments, but I don't think that's a nice thing to do with someone else's code. What is the issue with the comments? |
Cool, can you put a Big Scary Warning™ (perhaps a comment and a |
I have put it in the logs as a warning when people use the PostgreSQL log storage provider. |
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.
@RJPercival you cool?
ping @RJPercival |
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.
Are the tests mostly copied and pasted from the MySQL tests? If so, it'd be better to refactor into a test suite that can be applied to either the MySQL or Postgres implementations. That'd be fine as a follow-up though.
There appear to be a number of comments from @AlCutter that haven't been resolved yet. Since you've approved already, does that mean you're happy for those to be deferred, @AlCutter?
nil, // keygen | ||
false, // snapshot | ||
test.wantCode == codes.OK, | ||
false) |
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.
Why did we lose the comments from some of these lines?
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.
These comments were causing the server-side goimports to fail. I have no idea why. They checked out just fine on my local side. When I removed them, the autobuild succeeded. I have no problem with someone putting them back in.
nodeIDsToRead[i] = nodesToStore[i].NodeID | ||
} | ||
|
||
{ |
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.
Why the braces here?
Co-Authored-By: Rob Percival <[email protected]>
Co-Authored-By: Rob Percival <[email protected]>
Co-Authored-By: Rob Percival <[email protected]>
Co-Authored-By: Rob Percival <[email protected]>
Co-Authored-By: Rob Percival <[email protected]>
Co-Authored-By: Rob Percival <[email protected]>
I have lost the ability to see what's different between my storage.sql and the repo's version. Can you please manually resolve those conflicts? Thanks, Jim |
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've pushed a new version up, but I think we're still jammed up on storage.sql. I have no idea what its looking like on the repo side and I think you even moved it. Can you please make the fixes on your end, so I can re-sync and start pushing through my next series of updates?
Thanks,
Jim
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 bar a few unresolved comments and some future cleanup to share code with the MySQL implementation.
server/mock_log_operation.go
Outdated
reflect "reflect" | ||
|
||
gomock "github.com/golang/mock/gomock" |
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.
Did go generate
move this import?
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 guarantee it did. For some of the directories, I had to run goimports for all the files.
} | ||
|
||
func openTestDBOrDie() *sql.DB { | ||
db, err := testdb.NewTrillianDB(context.TODO()) |
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.
If you look at the diff for TestMain()
, you'll see that it used to create a Context
and pass it to testdb.NewTrillianDBOrDie()
. You could instead pass the context to openTestDBOrDie()
.
Oops, tried to push a merge as requested but got the command a little wrong and pushed my master branch onto yours, which happened to be where you were doing your work. Could you re-push your commits to your master branch please? |
Can do |
Done |
Hey, I have re-pushed the code and got it through the docker tests ( I think the resource wasn't available last time it rand ) , so we should be good to go now. Thanks, |
* master: (94 commits) Complete TODO (#1632) fake_node_reader: Remove unused field (#1631) Parallelize VerifyMapLeavesResponse (#1615) Remove redundant root hash calculations (#1630) sequencer: Consolidate compact.Tree initialization (#1629) Remove unused NodeReader method (#1625) Fix bazel build (#1627) added/updated postgresql implementation of log_storage (#1571) Clean up compact.Tree tests (#1622) Remove old hash list format from compact.Tree (#1621) Mention protoc-gen-doc in README.md merkle: Add testonly package with golden hashes (#1620) compact: Simplify getting hashes in NewTreeWithState (#1618) compact: Implement Tree using Range (#1522) Guard verbose logging in merkle path code (#1604) Make MaskLeft of NodeID return an explicit copy. (#1612) Convert directly from Int.Bits() to NodeID (#1614) Couple of changes to make NodeIDs more frugal. (#1613) compact.Tree: Change semantic of adding leaves (#1592) MapHasher: Do not return error from HashLeaf (#1611) ...
I have added the code to use the log_storage with postgres. This allows a third storage solution for the base set. I have not updated or implemented the map storage code yet, however.
Contributes to #1298.
Checklist