-
-
Notifications
You must be signed in to change notification settings - Fork 538
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
Implement SQLite Store using gorm and relational approach #1065
Conversation
4f625e7
to
5fbb609
Compare
I managed to make all tests pass with SQLite implementation. The testing matrix is extended to cover both file and SQLite store scenarios. The only exception is Windows as I keep getting:
This seems related to the cleanup procedure and needs further investigation. For now, SQLite store tests are disabled for Windows. I also added a sub-command that can help with the migration of json storage to the SQLite store:
By default, management uses JSON file store as before. To use SQLite there is an option in the config file |
312681e
to
dd93f14
Compare
dd93f14
to
6fe83f5
Compare
I managed to fix Sqlite store tests on Windows by not using |
6d6e2ff
to
64fcf7a
Compare
64fcf7a
to
1de1aea
Compare
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.
Because the global lock doing nothing then this line may cause problem. Here we write out the account but without account lock.
593d2e5
to
fead817
Compare
The global lock was implemented for SQLite. I managed to eliminate the usage of one global lock-in here. We may consider addressing the rest later. Additionally, I implemented a rollback command in case someone wants to migrate back from SQLite to the JSON store. Also, I made a few correctness checks by migrating a test
Then you have both
Which mostly are equivalents in the current file store implementation. Management should behave the same way with |
d74a0f9
to
9f978cf
Compare
This should allow avoid issue with gorm embedded_prefix_ and use id column name for Account table primary key.
This reverts commit 60d94a0.
7ae5f23
to
11be167
Compare
…1065) Restructure data handling for improved performance and flexibility. Introduce 'G'-prefixed fields to represent Gorm relations, simplifying resource management. Eliminate complexity in lookup tables for enhanced query and write speed. Enable independent operations on data structures, requiring adjustments in the Store interface and Account Manager.
…1065) Restructure data handling for improved performance and flexibility. Introduce 'G'-prefixed fields to represent Gorm relations, simplifying resource management. Eliminate complexity in lookup tables for enhanced query and write speed. Enable independent operations on data structures, requiring adjustments in the Store interface and Account Manager.
Describe your changes
This approach involves loading associated tables into slices and then converting them into maps. This technique is introducing additional fields prefixed with 'G' (shows Gorm relation), allowing for granular resource management without many changes to existing structures. While this approach introduces complexities, it serves the goal of achieving a functional implementation while minimizing disruptions to the current architecture.
One significant advantage is the elimination of the complexity associated with the lookup table used in the document-oriented approach. This simplification not only enhances query performance but also contributes to improved write speed, especially as the number of accounts grows.
Another key advantage introduced by the new relational approach is the ability to operate on separated data structures, such as accounts, users, and peers, independently. This level of separation empowers more granular and focused updates, ensuring that modifications to one resource do not require loading the entire account. But this may require additional changes in the Store interface and the Account Manager.
Benchmark Results:
We can see that the write speed of the relational approach is better compared with the result shown in #1030.
Unfortunately, the reading speed is worse but this might be due to the amount of copying I have to do when loading an account. This can be improved.
ERD diagram:
Issue ticket number and link
Checklist