ITS#10454 lmdb: can't rely on O_DSYNC on MacOS

So we must explicitly sync writes to the metapage.
This commit is contained in:
Howard Chu 2026-04-15 19:39:36 +01:00
parent e30a2d1672
commit bd9cd548b0

View file

@ -4865,6 +4865,12 @@ mdb_env_write_meta(MDB_txn *txn)
rc = ErrCode();
goto fail;
}
#if defined(__APPLE__)
if (MDB_FDATASYNC(env->me_mfd)) {
rc = ErrCode();
goto fail;
}
#endif
}
goto done;
}
@ -4924,6 +4930,12 @@ fail:
env->me_flags |= MDB_FATAL_ERROR;
return rc;
}
#if defined(__APPLE__)
if (mfd == env->me_mfd && MDB_FDATASYNC(env->me_mfd)) {
rc = ErrCode();
return rc;
}
#endif
/* MIPS has cache coherency issues, this is a no-op everywhere else */
CACHEFLUSH(env->me_map + off, len, DCACHE);
done: