Skip to content

Commit

Permalink
Fix i686 next-swc build due to int overflow (#70995)
Browse files Browse the repository at this point in the history
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: #69668
  • Loading branch information
ijjk authored and kdy1 committed Oct 10, 2024
1 parent 82f588a commit 0a5e8a8
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)?;
Expand Down

0 comments on commit 0a5e8a8

Please sign in to comment.