Skip to content

Commit 289e0ee

Browse files
committed
fix: revert chunk size to 128mb
1 parent c44026a commit 289e0ee

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

store/src/lmdb.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use crate::grin_core::ser::{self, DeserializationMode, ProtocolVersion};
2828
use crate::util::RwLock;
2929

3030
/// number of bytes to grow the database by when needed
31-
pub const ALLOC_CHUNK_SIZE_DEFAULT: usize = 134_217_728 / 32; //128 MB
31+
pub const ALLOC_CHUNK_SIZE_DEFAULT: usize = 134_217_728; //128 MB
3232
/// And for test mode, to avoid too much disk allocation on windows
3333
pub const ALLOC_CHUNK_SIZE_DEFAULT_TEST: usize = 1_048_576; //1 MB
3434
const RESIZE_PERCENT: f32 = 0.9;
@@ -185,7 +185,7 @@ impl Store {
185185
let migrate_from = Path::new(root_path).join(name);
186186
if name != ENV_NAME && migrate_from.exists() {
187187
debug!("Migrating {} to {:?}", name, full_path);
188-
if Self::migrate_to_default_env(&s, &migrate_from, db_name).is_ok() {
188+
if s.migrate_to_default_env(&migrate_from, db_name).is_ok() {
189189
let _ = fs::remove_dir_all(&migrate_from);
190190
} else {
191191
error!("Migrating {} failed", name);
@@ -194,11 +194,11 @@ impl Store {
194194
Ok(s)
195195
}
196196

197-
/// Migrate db from provided path to default environment.
198-
fn migrate_to_default_env(s: &Store, path: &Path, db_name: &str) -> Result<(), Error> {
197+
/// Migrate db from provided path to store environment.
198+
fn migrate_to_default_env(&self, path: &Path, db_name: &str) -> Result<(), Error> {
199199
let env = unsafe {
200200
let mut options = EnvOpenOptions::new().read_txn_without_tls();
201-
let env_options = options.map_size(s.alloc_chunk_size).max_dbs(1);
201+
let env_options = options.map_size(self.alloc_chunk_size).max_dbs(1);
202202
env_options.open(path)?
203203
};
204204
let db_from = {
@@ -207,8 +207,8 @@ impl Store {
207207
write.commit()?;
208208
db
209209
};
210-
let db_to = s.db.read();
211-
let mut write_to = s.env.write_txn()?;
210+
let db_to = self.db.read();
211+
let mut write_to = self.env.write_txn()?;
212212
let read_from = env.read_txn()?;
213213
let mut count = 0;
214214
for kv in db_from.iter(&read_from)? {

0 commit comments

Comments
 (0)