Unverified Commit 337e5f97 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Fix i686 next-swc build due to int overflow (#70995)

This ensures we don't hit the max 32 bit int size on our i686 Windows
build for `next-swc`. Validated fix against run here
https://github.com/vercel/next.js/actions/runs/11245636466/job/31266030793

x-ref:
https://github.com/vercel/next.js/actions/runs/11245312094/job/31265087281
x-ref: https://github.com/vercel/next.js/pull/69668
parent c17e225b
......@@ -61,6 +61,12 @@ pub struct LmdbBackingStorage {
impl LmdbBackingStorage {
pub fn new(path: &Path) -> Result<Self> {
create_dir_all(path)?;
#[cfg(target_arch = "x86")]
const MAP_SIZE: usize = usize::MAX;
#[cfg(not(target_arch = "x86"))]
const MAP_SIZE: usize = 40 * 1024 * 1024 * 1024;
let env = Environment::new()
.set_flags(
EnvironmentFlags::WRITE_MAP
......@@ -69,7 +75,7 @@ impl LmdbBackingStorage {
)
.set_max_readers((available_parallelism().map_or(16, |v| v.get()) * 8) as u32)
.set_max_dbs(5)
.set_map_size(40 * 1024 * 1024 * 1024)
.set_map_size(MAP_SIZE)
.open(path)?;
let infra_db = env.create_db(Some("infra"), DatabaseFlags::INTEGER_KEY)?;
let data_db = env.create_db(Some("data"), DatabaseFlags::INTEGER_KEY)?;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment