SQL support for LRR#86
Open
psilabs-dev wants to merge 9 commits into
Open
Conversation
da2d4fa to
5c496de
Compare
d974d71 to
20bfbd7
Compare
d93be98 to
70ac3db
Compare
42d712d to
92ca93d
Compare
otherwise a tag stats call would take 10s on 100k archives/tags
The cache and cache invalidation logic is incorrect and not well-planned.
11ae428 to
a94f13c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implementation of LANraragi API-compatible PostgreSQL data management layer for LRR with perl's DBI and DBD::pg.
dev-postgresql/main)User Guide/Warning
A Postgres database is required; tested on docker "postgres:17.4". Redis 7 is also required, as it is used for configuration and caching. Docker is the only supported platform.
Example docker compose:
Data Management
As this PR is in development and is downstream-only, schema changes may occur, and do not come with a migration script. Tables will not be amended with
ALTER, and indexes may be added or deleted between commit hashes, resulting in breaking changes and database incompatibility.Prepare to create/restore from backups, or prepare metadata via the API from a stable data source, and drop the postgres database entirely. This branch should not be the primary source of your archives' metadata management; assume that all data stored in this service is gone.
Terminology
A top-level entrypoint (TLE) is a subroutine/file which has no owning caller within the LRR application. Controllers, Shinobu, Minion, and LANraragi.pm are all top-level entrypoints.
An example of a file that is not a TLE is "lib/LANraragi/Model/Archive.pm", as
get_titleis called by "lib/LANraragi/Controller/Api/Archive.pm", which is within the project.Minion queues are TLE's: although they accept jobs from API endpoints which live in the Controller layer, that layer is separated from the workers via the Minion library which is not within LRR, and the controller layer does not own the minion jobs.
A subroutine is:
A redis-specific function and SQL-specific function are equivalent, if their function signatures/contract logic are the same.
The sets of dependencies of all TLE's span the PR migration scope. By corollary, orphans and dead code do not fall under this spanning space, as they are not used by any TLE.
Agnostic subroutines do not require any migration.
Merge Conflict Mitigation
To minimize merge conflict risk, we will use model layer injection and namespace-based reservation to reserve specific downstream modules.
This PR shall not modify or remove perl modules under "lib/LANraragi/Utils" and "lib/LANraragi/Model". Instead, new files will be placed under the "PsilabsDev" downstream namespace under "Utils" or "Model" carrying new or equivalent subroutines/logic, and the top-level entrypoints will be re-wired to these downstream modules if required.
Put another way, we have the following mitigation properties:
Equivalent subroutines must live in equivalent namespaced modules: for example, if a redis-specific subroutine lives in "lib/LANraragi/Utils/Abc.pm", then its postgres-equivalent subroutine must live in "lib/LANraragi/Utils/PsilabsDev/PgAbc.pm". An exception is made for novel logic not present in upstream.