mirror of
https://github.com/mozilla-services/syncstorage-rs.git
synced 2025-08-06 03:46:57 +02:00
chore: require minimum mysql 8 (#1717)
Some checks are pending
Glean probe-scraper / glean-probe-scraper (push) Waiting to run
Some checks are pending
Glean probe-scraper / glean-probe-scraper (push) Waiting to run
BREAKING CHANGE: now depending on >= mysql 8 features Closes STOR-160
This commit is contained in:
parent
b0c8ac50a0
commit
69005091a5
@ -271,7 +271,7 @@ jobs:
|
||||
RUST_BACKTRACE: 1
|
||||
# XXX: begin_test_transaction doesn't play nice over threaded tests
|
||||
RUST_TEST_THREADS: 1
|
||||
- image: cimg/mysql:5.7
|
||||
- image: cimg/mysql:8.0
|
||||
auth:
|
||||
username: $DOCKER_USER
|
||||
password: $DOCKER_PASS
|
||||
|
@ -37,7 +37,7 @@ Mozilla Sync Storage built with [Rust](https://rust-lang.org).
|
||||
- pkg-config
|
||||
- [Rust stable](https://rustup.rs)
|
||||
- python 3.9+
|
||||
- MySQL 5.7 (or compatible)
|
||||
- MySQL 8.0 (or compatible)
|
||||
* libmysqlclient (`brew install mysql` on macOS, `apt install libmysqlclient-dev` on Ubuntu, `apt install libmariadb-dev-compat` on Debian)
|
||||
|
||||
Depending on your OS, you may also need to install `libgrpcdev`,
|
||||
|
@ -11,7 +11,7 @@
|
||||
version: "3"
|
||||
services:
|
||||
sync-db:
|
||||
image: docker.io/library/mysql:5.7
|
||||
image: docker.io/library/mysql:8.0
|
||||
volumes:
|
||||
- sync_db_data:/var/lib/mysql
|
||||
restart: always
|
||||
@ -32,7 +32,7 @@ services:
|
||||
timeout: 2s
|
||||
|
||||
tokenserver-db:
|
||||
image: docker.io/library/mysql:5.7
|
||||
image: docker.io/library/mysql:8.0
|
||||
volumes:
|
||||
- tokenserver_db_data:/var/lib/mysql
|
||||
restart: always
|
||||
|
@ -26,7 +26,7 @@ services:
|
||||
environment:
|
||||
SYNC_SYNCSTORAGE__SPANNER_EMULATOR_HOST: sync-db:9020
|
||||
tokenserver-db:
|
||||
image: docker.io/library/mysql:5.7
|
||||
image: docker.io/library/mysql:8.0
|
||||
volumes:
|
||||
- tokenserver_db_data:/var/lib/mysql
|
||||
restart: always
|
||||
|
@ -1,43 +1,11 @@
|
||||
use diesel::{
|
||||
backend::Backend,
|
||||
insertable::CanInsertInSingleQuery,
|
||||
mysql::Mysql,
|
||||
query_builder::{AstPass, InsertStatement, QueryFragment, QueryId},
|
||||
query_dsl::methods::LockingDsl,
|
||||
result::QueryResult,
|
||||
Expression, RunQueryDsl, Table,
|
||||
};
|
||||
|
||||
/// Emit MySQL <= 5.7's `LOCK IN SHARE MODE`
|
||||
///
|
||||
/// MySQL 8 supports `FOR SHARE` as an alias (which diesel natively supports)
|
||||
pub trait LockInShareModeDsl {
|
||||
type Output;
|
||||
|
||||
fn lock_in_share_mode(self) -> Self::Output;
|
||||
}
|
||||
|
||||
impl<T> LockInShareModeDsl for T
|
||||
where
|
||||
T: LockingDsl<LockInShareMode>,
|
||||
{
|
||||
type Output = <T as LockingDsl<LockInShareMode>>::Output;
|
||||
|
||||
fn lock_in_share_mode(self) -> Self::Output {
|
||||
self.with_lock(LockInShareMode)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, QueryId)]
|
||||
pub struct LockInShareMode;
|
||||
|
||||
impl QueryFragment<Mysql> for LockInShareMode {
|
||||
fn walk_ast(&self, mut out: AstPass<'_, Mysql>) -> QueryResult<()> {
|
||||
out.push_sql(" LOCK IN SHARE MODE");
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct OnDuplicateKeyUpdate<T, U, Op, Ret, X>(Box<InsertStatement<T, U, Op, Ret>>, X);
|
||||
|
||||
|
@ -25,7 +25,6 @@ use syncstorage_settings::{Quota, DEFAULT_MAX_TOTAL_RECORDS};
|
||||
|
||||
use super::{
|
||||
batch,
|
||||
diesel_ext::LockInShareModeDsl,
|
||||
error::DbError,
|
||||
pool::CollectionCache,
|
||||
schema::{bso, collections, user_collections},
|
||||
@ -178,7 +177,7 @@ impl MysqlDb {
|
||||
.select(user_collections::modified)
|
||||
.filter(user_collections::user_id.eq(user_id))
|
||||
.filter(user_collections::collection_id.eq(collection_id))
|
||||
.lock_in_share_mode()
|
||||
.for_share()
|
||||
.first(&self.conn)
|
||||
.optional()?;
|
||||
if let Some(modified) = modified {
|
||||
|
Loading…
Reference in New Issue
Block a user