From b8f09aa90080a5958927d3e82e6db567d2a2c80c Mon Sep 17 00:00:00 2001 From: thawk105 Date: Sat, 20 Jun 2026 07:38:09 +0900 Subject: [PATCH] Fix WAL log preallocation: 10 ^ 9 (XOR=3) -> 1000000000 `ftruncate(10 ^ 9)` is a bitwise XOR yielding 3 bytes, not the intended 1e9 (1 GB) log preallocation. It also fails gcc-13 -Werror=xor-used-as-pow. Affects silo (ycsb/sbomb/tpcc/bomb) and ss2pl (bomb) under `#if WAL`. Found via Izanagi parameter-space full enumeration: the WAL code path is not compiled in default WAL=0 builds, so this stayed latent until WAL=1 was exercised across the optimization-flag hypercube. Co-Authored-By: Claude Opus 4.8 --- cc/silo/bomb_silo.cc | 2 +- cc/silo/sbomb_silo.cc | 2 +- cc/silo/tpcc_silo.cc | 2 +- cc/silo/ycsb_silo.cc | 2 +- cc/ss2pl/bomb_ss2pl.cc | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cc/silo/bomb_silo.cc b/cc/silo/bomb_silo.cc index cfc3229d..02b7c698 100644 --- a/cc/silo/bomb_silo.cc +++ b/cc/silo/bomb_silo.cc @@ -44,7 +44,7 @@ int main(int argc, char* argv[]) try { std::string logpath; genLogFile(logpath, thid); trans.logfile_.open(logpath, O_CREAT | O_TRUNC | O_WRONLY, 0644); - trans.logfile_.ftruncate(10 ^ 9); + trans.logfile_.ftruncate(1000000000); #else (void) trans; #endif diff --git a/cc/silo/sbomb_silo.cc b/cc/silo/sbomb_silo.cc index b74a76a1..c0e62110 100644 --- a/cc/silo/sbomb_silo.cc +++ b/cc/silo/sbomb_silo.cc @@ -43,7 +43,7 @@ int main(int argc, char* argv[]) try { std::string logpath; genLogFile(logpath, thid); trans.logfile_.open(logpath, O_CREAT | O_TRUNC | O_WRONLY, 0644); - trans.logfile_.ftruncate(10 ^ 9); + trans.logfile_.ftruncate(1000000000); #else (void) trans; #endif diff --git a/cc/silo/tpcc_silo.cc b/cc/silo/tpcc_silo.cc index 7ea90938..8bf6b808 100644 --- a/cc/silo/tpcc_silo.cc +++ b/cc/silo/tpcc_silo.cc @@ -43,7 +43,7 @@ int main(int argc, char* argv[]) try { std::string logpath; genLogFile(logpath, thid); trans.logfile_.open(logpath, O_CREAT | O_TRUNC | O_WRONLY, 0644); - trans.logfile_.ftruncate(10 ^ 9); + trans.logfile_.ftruncate(1000000000); #else (void) trans; #endif diff --git a/cc/silo/ycsb_silo.cc b/cc/silo/ycsb_silo.cc index 29237daa..2bb75ce2 100644 --- a/cc/silo/ycsb_silo.cc +++ b/cc/silo/ycsb_silo.cc @@ -44,7 +44,7 @@ int main(int argc, char* argv[]) try { std::string logpath; genLogFile(logpath, thid); trans.logfile_.open(logpath, O_CREAT | O_TRUNC | O_WRONLY, 0644); - trans.logfile_.ftruncate(10 ^ 9); + trans.logfile_.ftruncate(1000000000); #else (void) trans; #endif diff --git a/cc/ss2pl/bomb_ss2pl.cc b/cc/ss2pl/bomb_ss2pl.cc index c4fd477e..051d732b 100644 --- a/cc/ss2pl/bomb_ss2pl.cc +++ b/cc/ss2pl/bomb_ss2pl.cc @@ -42,7 +42,7 @@ int main(int argc, char* argv[]) try { std::string logpath; genLogFile(logpath, thid); trans.logfile_.open(logpath, O_CREAT | O_TRUNC | O_WRONLY, 0644); - trans.logfile_.ftruncate(10 ^ 9); + trans.logfile_.ftruncate(1000000000); #else (void) trans; #endif