diff options
author | Tor Egge <Tor.Egge@online.no> | 2021-09-28 15:51:13 +0200 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2021-09-28 15:51:13 +0200 |
commit | 01554de5b33e88e791fa9c4d916167cdaa90f517 (patch) | |
tree | a09dee3ed30ca84c2b50dde8d59cb94494c127e2 /searchcore/src/apps | |
parent | a157b68a895eaf62bcf753a2698a8617890248db (diff) |
Count moved documents in vespa-redistribute-bm.
Diffstat (limited to 'searchcore/src/apps')
-rw-r--r-- | searchcore/src/apps/vespa-redistribute-bm/vespa_redistribute_bm.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/searchcore/src/apps/vespa-redistribute-bm/vespa_redistribute_bm.cpp b/searchcore/src/apps/vespa-redistribute-bm/vespa_redistribute_bm.cpp index 0227d9539d2..43346c366c0 100644 --- a/searchcore/src/apps/vespa-redistribute-bm/vespa_redistribute_bm.cpp +++ b/searchcore/src/apps/vespa-redistribute-bm/vespa_redistribute_bm.cpp @@ -16,6 +16,7 @@ #include <vespa/searchcore/bmcluster/bm_node_stats.h> #include <vespa/searchcore/bmcluster/bm_node_stats_reporter.h> #include <vespa/searchcore/bmcluster/bm_range.h> +#include <vespa/searchcore/bmcluster/bucket_db_snapshot_vector.h> #include <vespa/searchcore/bmcluster/bucket_selector.h> #include <vespa/searchcore/bmcluster/calculate_moved_docs_ratio.h> #include <vespa/searchcore/bmcluster/estimate_moved_docs_ratio.h> @@ -178,7 +179,7 @@ class Benchmark { void adjust_cluster_state_before_feed(); void adjust_cluster_state_after_feed(); void adjust_cluster_state_after_first_redistribution(); - double estimate_lost_docs(); + double estimate_lost_unique_docs(); double estimate_moved_docs(); void feed(); std::chrono::duration<double> redistribute(); @@ -318,14 +319,13 @@ Benchmark::redistribute() } double -Benchmark::estimate_lost_docs() +Benchmark::estimate_lost_unique_docs() { switch (_params.get_mode()) { case Mode::PERM_CRASH: case Mode::TEMP_CRASH: { - double new_redundancy = std::min(_params.get_redundancy(), _params.get_num_nodes() - _params.get_flip_nodes()); - auto lost_docs_ratio = EstimateMovedDocsRatio().estimate_lost_docs_base_ratio(_params.get_redundancy(), _params.get_flip_nodes(), _params.get_num_nodes()) * new_redundancy; + auto lost_docs_ratio = EstimateMovedDocsRatio().estimate_lost_docs_base_ratio(_params.get_redundancy(), _params.get_flip_nodes(), _params.get_num_nodes()); return _params.get_documents() * lost_docs_ratio; } default: @@ -365,11 +365,15 @@ Benchmark::run() _cluster->start(_feed); feed(); LOG(info, "--------------------------------"); + auto old_snapshot = _cluster->get_bucket_db_snapshots(); adjust_cluster_state_after_feed(); auto elapsed = redistribute(); - double moved_docs = estimate_moved_docs(); - double lost_docs = estimate_lost_docs(); - LOG(info, "Redistributed estimated %4.2f docs in %5.3f seconds, %4.2f docs/s, estimated %4.2f lost docs", moved_docs, elapsed.count(), moved_docs / elapsed.count(), lost_docs); + double estimated_moved_docs = estimate_moved_docs(); + double estimated_lost_unique_docs = estimate_lost_unique_docs(); + auto new_snapshot = _cluster->get_bucket_db_snapshots(); + uint32_t moved_docs = new_snapshot.count_moved_documents(old_snapshot); + uint32_t lost_unique_docs = new_snapshot.count_lost_unique_documents(old_snapshot); + LOG(info, "Redistributed (estimated %4.2f) %u docs in %5.3f seconds, %4.2f docs/s, (estimated %4.2f) %u lost unique docs", estimated_moved_docs, moved_docs, elapsed.count(), moved_docs / elapsed.count(), estimated_lost_unique_docs, lost_unique_docs); if (_params.get_mode() == Mode::TEMP_CRASH) { if (_params.get_use_feed_settle()) { LOG(info, "Settling redistribution"); @@ -377,7 +381,7 @@ Benchmark::run() } adjust_cluster_state_after_first_redistribution(); elapsed = redistribute(); - LOG(info, "Cleanup of %4.2f docs in %5.3f seconds, %4.2f docs/s, estimated %4.2f refound docs", moved_docs, elapsed.count(), moved_docs / elapsed.count(), lost_docs); + LOG(info, "Cleanup of (estimated %4.2f) %u docs in %5.3f seconds, %4.2f docs/s, (estimated %4.2f) %u refound unique docs", estimated_moved_docs, moved_docs, elapsed.count(), moved_docs / elapsed.count(), estimated_lost_unique_docs, lost_unique_docs); } _cluster->stop(); } |