Skip to content

Commit 31d681f

Browse files
authored
Merge pull request #1399 from spacejam/tyler_always_use_threads
Require threads on all platforms.
2 parents 893c1a9 + fc01f0e commit 31d681f

File tree

10 files changed

+20
-121
lines changed

10 files changed

+20
-121
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
## Breaking Changes
2525

26+
* #1399 Bump MSRV to 1.51.
27+
* #1399 Thread support is now required on all platforms.
2628
* #1135 The "no_metrics" anti-feature has been replaced with
2729
the "metrics" positive feature.
2830
* #1178 the `Event` enum has become a unified struct that allows
@@ -50,7 +52,6 @@
5052
doesn't make sense for things that must fit in memory anyway.
5153
* #1314 `Subscriber::next_timeout` now requires a mutable self
5254
reference.
53-
* #1337 Bump MSRV to 1.48.
5455
* #1349 The "measure_allocs" feature has been removed.
5556
* #1354 `Error` has been modified to be Copy, removing all
5657
heap-allocated variants.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ extreme::run(async move {
161161

162162
# minimum supported Rust version (MSRV)
163163

164-
We support Rust 1.48.0 and up.
164+
We support Rust 1.51.0 and up.
165165

166166
# architecture
167167

scripts/cross_compile.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ rustup update --no-self-update
1212

1313
RUSTFLAGS="--cfg miri" cargo check
1414

15-
rustup toolchain install 1.48.0 --no-self-update
15+
rustup toolchain install 1.51.0 --no-self-update
1616
cargo clean
1717
rm Cargo.lock
18-
cargo +1.48.0 check
18+
cargo +1.51.0 check
1919

2020
for target in $targets; do
2121
echo "setting up $target..."

src/context.rs

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,7 @@ pub struct Context {
1212
/// When the last high-level reference is dropped, it
1313
/// should trigger all background threads to clean
1414
/// up synchronously.
15-
#[cfg(all(
16-
not(miri),
17-
any(
18-
windows,
19-
target_os = "linux",
20-
target_os = "macos",
21-
target_os = "dragonfly",
22-
target_os = "freebsd",
23-
target_os = "openbsd",
24-
target_os = "netbsd",
25-
target_os = "ios",
26-
)
27-
))]
15+
#[cfg(not(miri))]
2816
pub(crate) flusher: Arc<Mutex<Option<flusher::Flusher>>>,
2917
#[doc(hidden)]
3018
pub pagecache: PageCache,
@@ -47,19 +35,7 @@ impl Context {
4735
Ok(Self {
4836
config,
4937
pagecache,
50-
#[cfg(all(
51-
not(miri),
52-
any(
53-
windows,
54-
target_os = "linux",
55-
target_os = "macos",
56-
target_os = "dragonfly",
57-
target_os = "freebsd",
58-
target_os = "openbsd",
59-
target_os = "netbsd",
60-
target_os = "ios",
61-
)
62-
))]
38+
#[cfg(not(miri))]
6339
flusher: Arc::new(parking_lot::Mutex::new(None)),
6440
})
6541
}

src/db.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,7 @@ impl Db {
5353

5454
let context = Context::start(config)?;
5555

56-
#[cfg(all(
57-
not(miri),
58-
any(
59-
windows,
60-
target_os = "linux",
61-
target_os = "macos",
62-
target_os = "dragonfly",
63-
target_os = "freebsd",
64-
target_os = "openbsd",
65-
target_os = "netbsd",
66-
target_os = "ios",
67-
)
68-
))]
56+
#[cfg(not(miri))]
6957
{
7058
let flusher_pagecache = context.pagecache.clone();
7159
let flusher = context.flush_every_ms.map(move |fem| {

src/lib.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -225,19 +225,7 @@ pub mod fail;
225225
#[cfg(feature = "docs")]
226226
pub mod doc;
227227

228-
#[cfg(all(
229-
not(miri),
230-
any(
231-
windows,
232-
target_os = "linux",
233-
target_os = "macos",
234-
target_os = "dragonfly",
235-
target_os = "freebsd",
236-
target_os = "openbsd",
237-
target_os = "netbsd",
238-
target_os = "ios",
239-
)
240-
))]
228+
#[cfg(not(miri))]
241229
mod flusher;
242230

243231
#[cfg(feature = "event_log")]

src/pagecache/iobuf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ impl IoBufs {
873873
let max_header_stable_lsn = self.max_header_stable_lsn.clone();
874874
guard.defer(move || {
875875
trace!("bumping atomic header lsn to {}", stored_max_stable_lsn);
876-
bump_atomic_lsn(&max_header_stable_lsn, stored_max_stable_lsn)
876+
max_header_stable_lsn.fetch_max(stored_max_stable_lsn, SeqCst)
877877
});
878878
guard.flush();
879879
drop(guard);

src/pagecache/logger.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use std::fs::File;
22

33
use super::{
4-
arr_to_lsn, arr_to_u32, assert_usize, bump_atomic_lsn, decompress, header,
5-
iobuf, lsn_to_arr, pread_exact, pread_exact_or_eof, roll_iobuf, u32_to_arr,
6-
Arc, BasedBuf, DiskPtr, HeapId, IoBuf, IoBufs, LogKind, LogOffset, Lsn,
4+
arr_to_lsn, arr_to_u32, assert_usize, decompress, header, iobuf,
5+
lsn_to_arr, pread_exact, pread_exact_or_eof, roll_iobuf, u32_to_arr, Arc,
6+
BasedBuf, DiskPtr, HeapId, IoBuf, IoBufs, LogKind, LogOffset, Lsn,
77
MessageKind, Reservation, Serialize, Snapshot, BATCH_MANIFEST_PID,
88
COUNTER_PID, MAX_MSG_HEADER_LEN, META_PID, SEG_HEADER_LEN,
99
};
@@ -417,10 +417,9 @@ impl Log {
417417
reservation_lid,
418418
);
419419

420-
bump_atomic_lsn(
421-
&self.iobufs.max_reserved_lsn,
422-
reservation_lsn + inline_buf_len as Lsn - 1,
423-
);
420+
self.iobufs
421+
.max_reserved_lsn
422+
.fetch_max(reservation_lsn + inline_buf_len as Lsn - 1, SeqCst);
424423

425424
let (heap_reservation, heap_id) = if over_heap_threshold {
426425
let heap_reservation = self

src/pagecache/mod.rs

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -206,23 +206,6 @@ where
206206
usize::try_from(from).expect("lost data cast while converting to usize")
207207
}
208208

209-
// TODO remove this with atomic fetch_max if we increase MSRV to 1.45 or higher
210-
fn bump_atomic_lsn(atomic_lsn: &AtomicLsn, to: Lsn) {
211-
let mut current = atomic_lsn.load(Acquire);
212-
loop {
213-
if current >= to {
214-
return;
215-
}
216-
let last =
217-
atomic_lsn.compare_exchange_weak(current, to, SeqCst, SeqCst);
218-
if last.is_ok() {
219-
// we succeeded.
220-
return;
221-
}
222-
current = last.unwrap_err();
223-
}
224-
}
225-
226209
use std::convert::{TryFrom, TryInto};
227210

228211
pub(crate) const fn lsn_to_arr(number: Lsn) -> [u8; 8] {
@@ -997,7 +980,7 @@ impl PageCache {
997980
snapshot::write_snapshot(&self.config, &snapshot)?;
998981

999982
// NB: this must only happen after writing the snapshot to disk
1000-
bump_atomic_lsn(&self.snapshot_min_lsn, stable_lsn_before);
983+
self.snapshot_min_lsn.fetch_max(stable_lsn_before, SeqCst);
1001984

1002985
// explicitly drop this to make it clear that it needs to
1003986
// be held for the duration of the snapshot operation.
@@ -1100,19 +1083,7 @@ impl PageCacheInner {
11001083
/// move a page. Returns Ok(false) if there were no pages
11011084
/// to GC. Returns an Err if we encountered an IO problem
11021085
/// while performing this GC.
1103-
#[cfg(all(
1104-
not(miri),
1105-
any(
1106-
windows,
1107-
target_os = "linux",
1108-
target_os = "macos",
1109-
target_os = "dragonfly",
1110-
target_os = "freebsd",
1111-
target_os = "openbsd",
1112-
target_os = "netbsd",
1113-
target_os = "ios",
1114-
)
1115-
))]
1086+
#[cfg(not(miri))]
11161087
pub(crate) fn attempt_gc(&self) -> Result<bool> {
11171088
let guard = pin();
11181089
let cc = concurrency_control::read();

src/threadpool.rs

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,7 @@ use std::sync::Arc;
44

55
use crate::{OneShot, Result};
66

7-
#[cfg(all(
8-
not(miri),
9-
any(
10-
windows,
11-
target_os = "linux",
12-
target_os = "macos",
13-
target_os = "dragonfly",
14-
target_os = "freebsd",
15-
target_os = "openbsd",
16-
target_os = "netbsd",
17-
target_os = "ios",
18-
)
19-
))]
7+
#[cfg(not(miri))]
208
mod queue {
219
use std::{
2210
cell::RefCell,
@@ -220,19 +208,7 @@ where
220208
spawn_to(work, &queue::BLOCKING_QUEUE)
221209
}
222210

223-
#[cfg(any(
224-
miri,
225-
not(any(
226-
windows,
227-
target_os = "linux",
228-
target_os = "macos",
229-
target_os = "dragonfly",
230-
target_os = "freebsd",
231-
target_os = "openbsd",
232-
target_os = "netbsd",
233-
target_os = "ios",
234-
))
235-
))]
211+
#[cfg(miri)]
236212
mod queue {
237213
/// This is the polyfill that just executes things synchronously.
238214
use crate::{OneShot, Result};

0 commit comments

Comments
 (0)