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
feat: store signer state in sqlite #4348
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## next #4348 +/- ##
===========================================
- Coverage 83.17% 66.86% -16.32%
===========================================
Files 451 452 +1
Lines 324497 326005 +1508
Branches 318 323 +5
===========================================
- Hits 269916 217990 -51926
- Misses 54573 108007 +53434
Partials 8 8
... and 270 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Reviews can progress , hold off merge until casting DKG vote PR is merged |
0a09039
to
5a4d643
Compare
@jcnelson FYI I've rebased off of Jacinta's PR and removed all of the I follow your idea of instantiating a struct inside of a thread, but I haven't found a way of doing that without getting the same compiler error. I would still need some struct to have something like |
073522e
to
9487700
Compare
9858d59
to
66c6862
Compare
5a4d643
to
3275172
Compare
Could also add some tests for in memory rather than using files :P |
You need to update the construction of the signer file to include the database name. i.e. add |
Whenever I try to run the integration tests I get complaints about too many open files. I thought maybe you would need to reduce the number of signers, but I am surprised that having 10 open files is too much (it runs with 10 signers) E.g. test that failed for me |
Ah I see. I will update this. This feels like the type of error that shouldn't pass compilation or unit tests. I might refactor that function in the process if I spot any simple enhancements. |
Interesting. I'll try running it and see if I encounter the same behavior. |
Remember that each signer has multiple connections (event queues, web server, rpc client, etc). If we're adding sqlite to the mix we might be hitting some limits. What platform are you seeing the errors on? Mac or Linux? Version? |
I have tried multiple times now and I'm not managing to reproduce any error so far. |
Done ✅ |
Sure. I added another test now. It feels a bit outside our domain to do this since we have no specific code path for the in-memory database in our code base, but why not? Let's be defensive. |
Co-authored-by: Hank Stoever <hstove@gmail.com>
This PR adds a new mod at
stacks-signer/src/signerdb.rs
with functions to interact with a SQLite database for state management.This is built on top of #4287 because that PR refactors a lot of the signer file structure.
At the moment, this replaces a
HashMap
that was used for storing block information.