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

chore: update to Rust 1.58 and switch to GCP Rust crate #1201

Merged
merged 9 commits into from
Jan 24, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
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
12 changes: 7 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ diesel_migrations = { version = "1.4.0", features = ["mysql"] }
docopt = "1.1.0"
env_logger = "0.9"
futures = { version = "0.3", features = ["compat"] }
googleapis-raw = { version = "0", path = "vendor/mozilla-rust-sdk/googleapis-raw" }
google-cloud-rust-raw = "0.11.0"
# Some versions of OpenSSL 1.1.1 conflict with grpcio's built-in boringssl which can cause
# syncserver to either fail to either compile, or start. In those cases, try
# `cargo build --features grpcio/openssl ...`
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.57-buster as builder
FROM rust:1.58-buster as builder
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well since this hasn't merged yet (and its docker is up now) :)

Suggested change
FROM rust:1.58-buster as builder
FROM rust:1.58.1-buster as builder

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that if you specify 1.58, it pulls in the latest version subversion.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just did a docker pull rust:1.58-buster and an internal shell
rustup show shows 1.58.1

WORKDIR /app
ADD . /app
ENV PATH=$PATH:/root/.cargo/bin
Expand Down
9 changes: 3 additions & 6 deletions src/bin/purge_ttl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::time::{Duration, Instant};
use cadence::{
BufferedUdpMetricSink, Metric, QueuingMetricSink, StatsdClient, Timed, DEFAULT_PORT,
};
use googleapis_raw::spanner::v1::{
use google_cloud_rust_raw::spanner::v1::{
spanner::{
BeginTransactionRequest, CommitRequest, CreateSessionRequest, ExecuteSqlRequest, Session,
},
Expand Down Expand Up @@ -141,7 +141,7 @@ fn commit_transaction(
}

pub struct SyncResultSet {
result: googleapis_raw::spanner::v1::result_set::ResultSet,
result: google_cloud_rust_raw::spanner::v1::result_set::ResultSet,
}

impl Iterator for SyncResultSet {
Expand Down Expand Up @@ -209,10 +209,7 @@ fn delete_incremental(

total += 1;
}
delete_sql = format!(
"{})",
delete_sql.trim_end_matches(&", ".to_string()).to_string()
);
delete_sql = format!("{})", delete_sql.trim_end_matches(&", ".to_string()));
trace!("Deleting chunk with: {}", delete_sql);
let mut delete_req = continue_transaction(session, txn.clone());
delete_req.set_sql(delete_sql);
Expand Down
1 change: 1 addition & 0 deletions src/db/mysql/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ pub struct MysqlDb {
/// Despite the db conn structs being !Sync (see Arc<MysqlDbInner> above) we
/// don't spawn multiple MysqlDb calls at a time in the thread pool. Calls are
/// queued to the thread pool via Futures, naturally serialized.
#[allow(clippy::non_send_fields_in_send_ty)]
unsafe impl Send for MysqlDb {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's kill this, the warning was reverted in 1.58.1

Suggested change
#[allow(clippy::non_send_fields_in_send_ty)]
unsafe impl Send for MysqlDb {}
unsafe impl Send for MysqlDb {}


pub struct MysqlDbInner {
Expand Down
2 changes: 1 addition & 1 deletion src/db/spanner/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{
str::FromStr,
};

use googleapis_raw::spanner::v1::type_pb::{StructType, Type, TypeCode};
use google_cloud_rust_raw::spanner::v1::type_pb::{StructType, Type, TypeCode};
use protobuf::{
well_known_types::{ListValue, Value},
RepeatedField,
Expand Down
2 changes: 1 addition & 1 deletion src/db/spanner/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ macro_rules! params {
#[test]
fn test_params_macro() {
use crate::db::spanner::support::ToSpannerValue;
use googleapis_raw::spanner::v1::type_pb::{Type, TypeCode};
use google_cloud_rust_raw::spanner::v1::type_pb::{Type, TypeCode};
use protobuf::{
well_known_types::{ListValue, Value},
RepeatedField,
Expand Down
2 changes: 1 addition & 1 deletion src/db/spanner/manager/session.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use actix_web::web::block;
use googleapis_raw::spanner::v1::{
use google_cloud_rust_raw::spanner::v1::{
spanner::{CreateSessionRequest, GetSessionRequest, Session},
spanner_grpc::SpannerClient,
};
Expand Down
2 changes: 1 addition & 1 deletion src/db/spanner/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::{
};

use futures::future::TryFutureExt;
use googleapis_raw::spanner::v1::{
use google_cloud_rust_raw::spanner::v1::{
mutation::{Mutation, Mutation_Write},
spanner::{BeginTransactionRequest, CommitRequest, ExecuteSqlRequest, RollbackRequest},
transaction::{
Expand Down
2 changes: 1 addition & 1 deletion src/db/spanner/support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{
};

use futures::stream::{StreamExt, StreamFuture};
use googleapis_raw::spanner::v1::{
use google_cloud_rust_raw::spanner::v1::{
result_set::{PartialResultSet, ResultSetMetadata, ResultSetStats},
spanner::ExecuteSqlRequest,
type_pb::{StructType_Field, Type, TypeCode},
Expand Down
2 changes: 1 addition & 1 deletion src/db/tests/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ async fn get_bsos() -> Result<()> {
uid,
coll,
// XXX: to_string?
&format!("b{}", revi.to_string()),
&format!("b{}", revi),
Some("Hello"),
Some(*sortindex),
None,
Expand Down
2 changes: 1 addition & 1 deletion src/db/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl SyncTimestamp {
/// string such as 1996-12-19T16:39:57-08:00
pub fn from_rfc3339(val: &str) -> Result<Self, DbError> {
let dt = DateTime::parse_from_rfc3339(val)
.map_err(|e| DbErrorKind::Integrity(format!("Invalid TIMESTAMP {}", e.to_string())))?;
.map_err(|e| DbErrorKind::Integrity(format!("Invalid TIMESTAMP {}", e)))?;
Self::from_datetime(dt)
}

Expand Down
1 change: 1 addition & 0 deletions src/tokenserver/db/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pub struct TokenserverDb {
/// Despite the db conn structs being !Sync (see Arc<MysqlDbInner> above) we
/// don't spawn multiple MysqlDb calls at a time in the thread pool. Calls are
/// queued to the thread pool via Futures, naturally serialized.
#[allow(clippy::non_send_fields_in_send_ty)]
unsafe impl Send for TokenserverDb {}

pub struct DbInner {
Expand Down
4 changes: 0 additions & 4 deletions vendor/mozilla-rust-sdk/.gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions vendor/mozilla-rust-sdk/.gitmodules

This file was deleted.

19 changes: 0 additions & 19 deletions vendor/mozilla-rust-sdk/Cargo.toml

This file was deleted.

30 changes: 0 additions & 30 deletions vendor/mozilla-rust-sdk/README.md

This file was deleted.

1 change: 0 additions & 1 deletion vendor/mozilla-rust-sdk/docker/.gitignore

This file was deleted.

44 changes: 0 additions & 44 deletions vendor/mozilla-rust-sdk/docker/Dockerfile

This file was deleted.

26 changes: 0 additions & 26 deletions vendor/mozilla-rust-sdk/docker/README.md

This file was deleted.

11 changes: 0 additions & 11 deletions vendor/mozilla-rust-sdk/docker/docker-compose.yml

This file was deleted.

1 change: 0 additions & 1 deletion vendor/mozilla-rust-sdk/googleapis-raw/.gitignore

This file was deleted.

32 changes: 0 additions & 32 deletions vendor/mozilla-rust-sdk/googleapis-raw/Cargo.toml

This file was deleted.

Loading