-
Notifications
You must be signed in to change notification settings - Fork 180
RUST-1605 Update to use libmongocrypt fle2v2 #863
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1983,6 +1983,7 @@ buildvariants: | |
os: | ||
- ubuntu-20.04 | ||
mongodb-version: | ||
- "latest" | ||
- "rapid" | ||
- "6.0" | ||
topology: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -565,6 +565,29 @@ impl Client { | |
&self.inner.topology | ||
} | ||
|
||
#[cfg(feature = "in-use-encryption-unstable")] | ||
pub(crate) async fn primary_description(&self) -> Option<crate::sdam::ServerDescription> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The spec includes a clause that creating collections with encrypted fields must be denied if the primary is <7.0. The reference implementation in the C driver actually does a full connection checkout to test that, but this lets us avoid that. Unfortunately, simply peeking the latest topology description doesn't work because it's possible to call |
||
let start_time = Instant::now(); | ||
let timeout = self | ||
.inner | ||
.options | ||
.server_selection_timeout | ||
.unwrap_or(DEFAULT_SERVER_SELECTION_TIMEOUT); | ||
let mut watcher = self.inner.topology.watch(); | ||
loop { | ||
let topology = watcher.observe_latest(); | ||
if let Some(desc) = topology.description.primary() { | ||
return Some(desc.clone()); | ||
} | ||
if !watcher | ||
.wait_for_update(timeout - start_time.elapsed()) | ||
.await | ||
{ | ||
return None; | ||
} | ||
} | ||
} | ||
|
||
#[cfg(feature = "in-use-encryption-unstable")] | ||
pub(crate) fn weak(&self) -> WeakClient { | ||
WeakClient { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -379,6 +379,22 @@ impl Database { | |
Some(f) => f, | ||
None => return Ok(()), | ||
}; | ||
let max_wire = match self.client().primary_description().await { | ||
Some(p) => p.max_wire_version()?, | ||
None => None, | ||
}; | ||
const SERVER_7_0_0_WIRE_VERSION: i32 = 21; | ||
match max_wire { | ||
Some(v) if v >= SERVER_7_0_0_WIRE_VERSION => (), | ||
_ => { | ||
return Err(ErrorKind::IncompatibleServer { | ||
message: "Driver support of Queryable Encryption is incompatible with server. \ | ||
Upgrade server to use Queryable Encryption." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: can we add here that the min version to use queryable encryption is 7.0? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately not - the spec mandates (and the test validate) this precise error message. |
||
.to_string(), | ||
} | ||
.into()) | ||
} | ||
} | ||
for ns in crate::client::csfle::aux_collections(base_ns, enc_fields)? { | ||
let mut sub_opts = opts.clone(); | ||
sub_opts.clustered_index = Some(self::options::ClusteredIndex { | ||
|
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.
The updated tests can only run on 7.0+, which the csfle suite wasn't running on before.
latest
as of yesterday was"7.1.0-alpha-220-g77c517c"
so that covers it, and it seems good to be running csfle tests againstlatest
anyway.