Skip to content
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: Syncstorage inital sqlite support #1520

Draft
wants to merge 56 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
f646ddf
style: Rename MysqlError to SqlError as they are generic
Eragonfr Oct 29, 2024
f423a33
refactor: Don't use legacy numerics contant and methods
Eragonfr Oct 29, 2024
af22b24
style: Cargo fmt
Eragonfr Oct 31, 2024
07a816a
style: Keep Mysql specific error in Mysql code
Eragonfr Nov 2, 2024
2637fd4
style: Rename MysqlError to SqlError as they are generic
Eragonfr Oct 29, 2024
7ea1c74
feat: Add sqlite as a storage backend
Eragonfr Mar 10, 2024
5ce2884
feat: Better readme doc for sqlite
Eragonfr Mar 10, 2024
a3dcdfb
refactor: Shorter lines in markdown
Eragonfr Mar 10, 2024
a686396
ci: Add sqlite clippy to CI check
Eragonfr Mar 10, 2024
4bdec19
docs: Use mysql as default example backend
Eragonfr Apr 6, 2024
37b8e48
fix: Add missing Sqlite in Enum
Eragonfr Apr 6, 2024
4b9af62
ci: Ignore libsqlite3-sys RUSTSEC-2022-0090 CVE
Eragonfr May 9, 2024
4cd3ce7
ci: Explain why RUSTSEC-2022-0090 is ignored
Eragonfr May 12, 2024
3e6c01c
refactor: Add shared crate for common code of SQL backends
Eragonfr Jul 5, 2024
62c01c4
refactor: Run cargo fmt
Eragonfr Jul 5, 2024
0df32cd
First attempts at getting SQLite + Docker working
bcspragu Aug 9, 2024
9174625
Seemingly functional SQLite?
bcspragu Aug 9, 2024
487d1aa
Remove vestigial .dockerignore line
bcspragu Aug 9, 2024
8135fe6
Remove unused import
bcspragu Aug 9, 2024
98344e2
fix: Error message should mention sqlite feature flag
Eragonfr Aug 11, 2024
ccfcfd4
ci: Set features for cargo build
Eragonfr Aug 11, 2024
6224499
fix: Incorrect URL for tokenserver db pool init
Eragonfr Aug 15, 2024
08fecd6
Run cargo fmt
Eragonfr Aug 15, 2024
cdbf5ba
ci: Set features for cargo test
Eragonfr Aug 15, 2024
bc3308c
ci: Enable the correct features in dockerfile
Eragonfr Aug 16, 2024
a6954bc
ci: Add sqlite docker & e2e tests
Eragonfr Aug 16, 2024
2baa33d
ci: Fix identation errors
Eragonfr Aug 16, 2024
e80b0cd
Remove editor config file
Eragonfr Aug 16, 2024
97321cb
ci: I hate tab-based configuration files
Eragonfr Aug 16, 2024
10c5acd
ci: Require sqlite e2e for deploy python utils
Eragonfr Aug 16, 2024
3268ef6
fix: Pass some SQLite tests for syncstorage
Eragonfr Sep 9, 2024
f393be5
fix: Revert modifications in Makefile from 2c1b7cf
Eragonfr Sep 9, 2024
24aeee4
fix: Run cargo fmt
Eragonfr Sep 11, 2024
f2a2bba
ci: Rename db for e2e tests
Eragonfr Sep 22, 2024
c9e2a36
fix: test_sqlite need persistence between tests
Eragonfr Sep 22, 2024
120f47c
refactor: Move tokenserver SQL strings into subcrates
Eragonfr Sep 22, 2024
0f91726
refactor: Add fixme to (some) queries
Eragonfr Oct 19, 2024
26e814a
refactor: cargo fmt
Eragonfr Oct 19, 2024
d96db99
style: Better readability with spacing
Eragonfr Oct 29, 2024
0c80393
refactor: Only include error.rs for sql backends.
Eragonfr Oct 29, 2024
af8e97d
fix: Remove static lifetime from &str
Eragonfr Nov 2, 2024
2398821
fix: The cfg check is true if more than one feature is enabled
Eragonfr Nov 2, 2024
3273026
feat: Only allow for one database feature to be used for tokenserver
Eragonfr Nov 2, 2024
e5b2e5a
fix: Table id should be primary key integer
Eragonfr Nov 6, 2024
f677a25
fix: SQLite syntax for some more queries
Eragonfr Nov 6, 2024
8dae1e1
fix: replace GREATEST with MAX
Eragonfr Nov 12, 2024
8773d69
fix: Use REMOVE_NODE_SYNC_QUERY to remove node
Eragonfr Nov 13, 2024
8a915f9
ci: Try to fix SQLite e2e tests by closing the db between each transa…
Eragonfr Nov 13, 2024
75a9a26
feat: Put MySQL and Sqlite test connexions behind flag
Eragonfr Nov 20, 2024
3364a5b
Merge remote-tracking branch 'moz/master' into syncstorage-sqlite
Eragonfr Dec 9, 2024
c8f21bd
test: Try to open/close database before each transaction
Eragonfr Dec 18, 2024
11aa6b7
Revert "test: Try to open/close database before each transaction"
Eragonfr Dec 18, 2024
e929cd8
ci: Minimum allowed time for Pool idle time is 1 sec
Eragonfr Jan 2, 2025
ffd1bd9
ci: Add idle_timeout
Eragonfr Jan 2, 2025
ab6ee22
test: Try to open/close database before each transaction
Eragonfr Dec 18, 2024
ed0e727
ci: Disable connection pooling for e2e tests
Eragonfr Jan 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cargo/audit.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[advisories]
ignore = [
"RUSTSEC-2024-0365", # Bound by diesel 1.4 (4GB limit n/a to tokenserver)
"RUSTSEC-2022-0090", # Bound by diesel 1.4.8, diesel_migrations 1.4.0, diesel_logger 0.1.1
]
96 changes: 91 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,25 @@ commands:
- run:
name: Rust Clippy MySQL
command: |
cargo clippy --workspace --all-targets --no-default-features --features=syncstorage-db/mysql --features=py_verifier -- -D warnings
cargo clippy --workspace --all-targets --no-default-features --features=mysql,py_verifier -- -D warnings
rust-clippy-sqlite:
steps:
- run:
name: Rust Clippy SQLite
command: |
cargo clippy --workspace --all-targets --no-default-features --features=sqlite,py_verifier -- -D warnings
rust-clippy-spanner:
steps:
- run:
name: Rust Clippy Spanner
command: |
cargo clippy --workspace --all-targets --no-default-features --features=syncstorage-db/spanner --features=py_verifier -- -D warnings
cargo clippy --workspace --all-targets --no-default-features --features=spanner,py_verifier -- -D warnings
cargo-build:
steps:
- run:
name: cargo build
command: cargo build
# This only builds the mysql version as it was the old default
command: cargo build --workspace --all-targets --no-default-features --features=mysql,py_verifier
setup-mysql:
steps:
- run:
Expand Down Expand Up @@ -95,10 +102,10 @@ commands:
steps:
- run:
name: cargo test
command: cargo test --workspace --verbose
command: cargo test --workspace --verbose --no-default-features --features mysql,py_verifier
- run:
name: quota test
command: cargo test --workspace --verbose
command: cargo test --workspace --verbose --no-default-features --features mysql,py_verifier
environment:
SYNC_SYNCSTORAGE__ENFORCE_QUOTA: 1

Expand All @@ -116,6 +123,20 @@ commands:
environment:
SYNCSTORAGE_RS_IMAGE: app:build

run-e2e-sqlite-tests:
steps:
- run:
name: e2e tests (syncstorage sqlite)
command: >
/usr/local/bin/docker-compose
-f docker-compose.sqlite.yaml
-f docker-compose.e2e.sqlite.yaml
up
--exit-code-from sqlite-e2e-tests
--abort-on-container-exit
environment:
SYNCSTORAGE_RS_IMAGE: app:build

run-tokenserver-scripts-tests:
steps:
- run:
Expand Down Expand Up @@ -251,6 +272,38 @@ jobs:
paths:
- /home/circleci/cache

build-sqlite-image:
docker:
- image: cimg/rust:1.78.0 # RUST_VER
auth:
username: $DOCKER_USER
password: $DOCKER_PASS
resource_class: large
steps:
- setup_remote_docker:
docker_layer_caching: true
- checkout
- display-versions
- write-version
- run:
name: Build SQLite Docker image
command: docker build -t app:build --build-arg DATABASE_BACKEND=sqlite .
no_output_timeout: 30m
# save the built docker container into CircleCI's cache. This is
# required since Workflows do not have the same remote docker instance.
- run:
name: docker save app:build
command: |
mkdir -p /home/circleci/cache
docker save -o /home/circleci/cache/docker.tar "app:build"
- run:
name: Save docker-compose config
command: cp docker-compose*sqlite.yaml /home/circleci/cache
- save_cache:
key: sqlite-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}-{{ epoch }}
paths:
- /home/circleci/cache

build-spanner-image:
docker:
- image: cimg/rust:1.78.0 # RUST_VER
Expand Down Expand Up @@ -321,6 +374,25 @@ jobs:
command: cp /home/circleci/cache/docker-compose*.yaml .
- run-e2e-spanner-tests

sqlite-e2e-tests:
docker:
- image: docker/compose:1.24.0
auth:
username: $DOCKER_USER
password: $DOCKER_PASS
steps:
- setup_remote_docker
- display-versions
- restore_cache:
key: sqlite-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Restore Docker image cache
command: docker load -i /home/circleci/cache/docker.tar
- run:
name: Restore docker-compose config
command: cp /home/circleci/cache/docker-compose*.yaml .
- run-e2e-sqlite-tests

deploy:
docker:
- image: docker:18.02.0-ce
Expand Down Expand Up @@ -422,6 +494,12 @@ workflows:
filters:
tags:
only: /.*/
- build-sqlite-image:
requires:
- build-and-test
filters:
tags:
only: /.*/
- mysql-e2e-tests:
requires:
- build-mysql-image
Expand All @@ -434,10 +512,17 @@ workflows:
filters:
tags:
only: /.*/
- sqlite-e2e-tests:
requires:
- build-sqlite-image
filters:
tags:
only: /.*/
- deploy:
requires:
- mysql-e2e-tests
- spanner-e2e-tests
- sqlite-e2e-tests
filters:
tags:
only: /.*/
Expand All @@ -448,6 +533,7 @@ workflows:
requires:
- mysql-e2e-tests
- spanner-e2e-tests
- sqlite-e2e-tests
filters:
tags:
only: /.*/
Loading