From 6e170c8b786a443bfece65f28e33d1b5455b269c Mon Sep 17 00:00:00 2001 From: warptangent Date: Sat, 11 Jul 2015 12:28:20 -0700 Subject: Optionally allow DB to know expected number of blocks at batch transaction start This will assist in a DB resize check. --- src/blockchain_utilities/fake_core.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/blockchain_utilities') diff --git a/src/blockchain_utilities/fake_core.h b/src/blockchain_utilities/fake_core.h index 79fb51842..5eda504fe 100644 --- a/src/blockchain_utilities/fake_core.h +++ b/src/blockchain_utilities/fake_core.h @@ -96,9 +96,9 @@ struct fake_core_lmdb return m_storage.get_db().add_block(blk, block_size, cumulative_difficulty, coins_generated, txs); } - void batch_start() + void batch_start(uint64_t batch_num_blocks = 0) { - m_storage.get_db().batch_start(); + m_storage.get_db().batch_start(batch_num_blocks); } void batch_stop() @@ -150,7 +150,7 @@ struct fake_core_memory return 2; } - void batch_start() + void batch_start(uint64_t batch_num_blocks = 0) { LOG_PRINT_L0("WARNING: [batch_start] opt_batch set, but this database doesn't support/need transactions - ignoring"); } -- cgit v1.2.3 From 699e4b3f65baf8bb2ddd2377dc74e2a3168c6244 Mon Sep 17 00:00:00 2001 From: warptangent Date: Sat, 11 Jul 2015 12:32:49 -0700 Subject: blockchain_utilities: Pass expected number of blocks when starting batch --- src/blockchain_utilities/blockchain_converter.cpp | 4 ++-- src/blockchain_utilities/blockchain_import.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/blockchain_utilities') diff --git a/src/blockchain_utilities/blockchain_converter.cpp b/src/blockchain_utilities/blockchain_converter.cpp index 855dde644..d18ce8789 100644 --- a/src/blockchain_utilities/blockchain_converter.cpp +++ b/src/blockchain_utilities/blockchain_converter.cpp @@ -236,7 +236,7 @@ int main(int argc, char* argv[]) } if (opt_batch) - blockchain->batch_start(); + blockchain->batch_start(db_batch_size); uint64_t i = 0; for (i = start_block; i < end_block + 1; ++i) { @@ -277,7 +277,7 @@ int main(int argc, char* argv[]) std::cout << "\r \r"; std::cout << "[- batch commit at height " << i + 1 << " -]" << ENDL; blockchain->batch_stop(); - blockchain->batch_start(); + blockchain->batch_start(db_batch_size); std::cout << ENDL; blockchain->show_stats(); } diff --git a/src/blockchain_utilities/blockchain_import.cpp b/src/blockchain_utilities/blockchain_import.cpp index aeed2b335..924b46d2d 100644 --- a/src/blockchain_utilities/blockchain_import.cpp +++ b/src/blockchain_utilities/blockchain_import.cpp @@ -254,7 +254,7 @@ int import_from_file(FakeCore& simple_core, std::string& import_file_path, uint6 } if (use_batch) - simple_core.batch_start(); + simple_core.batch_start(db_batch_size); LOG_PRINT_L0("Reading blockchain from bootstrap file..."); std::cout << ENDL; @@ -482,7 +482,7 @@ int import_from_file(FakeCore& simple_core, std::string& import_file_path, uint6 // zero-based height std::cout << ENDL << "[- batch commit at height " << h-1 << " -]" << ENDL; simple_core.batch_stop(); - simple_core.batch_start(); + simple_core.batch_start(db_batch_size); std::cout << ENDL; #if !defined(BLOCKCHAIN_DB) || (BLOCKCHAIN_DB == DB_LMDB) simple_core.m_storage.get_db().show_stats(); -- cgit v1.2.3 From f9e4afd52a404f49dc71709e35c88e0d6a4ecbaa Mon Sep 17 00:00:00 2001 From: warptangent Date: Sat, 11 Jul 2015 12:38:20 -0700 Subject: blockchain_utilities: Increase debug statement's log level --- src/blockchain_utilities/bootstrap_file.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/blockchain_utilities') diff --git a/src/blockchain_utilities/bootstrap_file.cpp b/src/blockchain_utilities/bootstrap_file.cpp index 70f0b1fec..573cb1572 100644 --- a/src/blockchain_utilities/bootstrap_file.cpp +++ b/src/blockchain_utilities/bootstrap_file.cpp @@ -454,7 +454,7 @@ uint64_t BootstrapFile::count_blocks(const std::string& import_file_path) str1.assign(buf1, sizeof(chunk_size)); if (! ::serialization::parse_binary(str1, chunk_size)) throw std::runtime_error("Error in deserialization of chunk_size"); - LOG_PRINT_L1("chunk_size: " << chunk_size); + LOG_PRINT_L3("chunk_size: " << chunk_size); if (chunk_size > BUFFER_SIZE) { -- cgit v1.2.3