MDBEnv::MDBEnv(const char* fname, int flags, int mode)
{
- mdb_env_create(&d_env);
- if(mdb_env_set_mapsize(d_env, 16ULL*4096*244140ULL)) // 4GB
+ mdb_env_create(&d_env);
+ uint64_t mapsizeMB = (sizeof(long)==4) ? 100 : 16000;
+ // on 32 bit platforms, there is just no room for more
+ if(mdb_env_set_mapsize(d_env, mapsizeMB * 1048576))
throw std::runtime_error("setting map size");
/*
Various other options may also need to be set before opening the handle, e.g. mdb_env_set_mapsize(), mdb_env_set_maxreaders(), mdb_env_set_maxdbs(),
{
declare(suffix,"filename","Filename for lmdb","./pdns.lmdb");
declare(suffix,"sync-mode","Synchronisation mode: nosync, nometasync, mapasync","mapasync");
- declare(suffix,"shards","Records database will be split into this number of shards","64");
+ // there just is no room for more on 32 bit
+ declare(suffix,"shards","Records database will be split into this number of shards", (sizeof(long) == 4) ? "2" : "64");
}
DNSBackend *make(const string &suffix="")
{