Skip to content

Commit 2bc7ad9

Browse files
authored
Revert "add progress reporting when rebuilding HNSW index"
1 parent 78d5400 commit 2bc7ad9

File tree

2 files changed

+3
-55
lines changed

2 files changed

+3
-55
lines changed

searchlib/src/vespa/searchlib/tensor/tensor_attribute_loader.cpp

+2-52
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@
1313
#include <vespa/searchlib/attribute/load_utils.h>
1414
#include <vespa/searchlib/attribute/readerbase.h>
1515
#include <vespa/searchlib/util/disk_space_calculator.h>
16-
#include <vespa/vespalib/objects/nbostream.h>
1716
#include <vespa/vespalib/util/arrayqueue.hpp>
1817
#include <vespa/vespalib/util/cpu_usage.h>
19-
#include <vespa/vespalib/util/jsonwriter.h>
2018
#include <vespa/vespalib/util/lambdatask.h>
21-
#include <vespa/vespalib/util/time.h>
19+
#include <vespa/vespalib/objects/nbostream.h>
2220
#include <condition_variable>
2321
#include <filesystem>
2422
#include <mutex>
@@ -43,15 +41,12 @@ bool
4341
can_use_index_save_file(const search::attribute::Config &config, const AttributeHeader& header)
4442
{
4543
if (!config.hnsw_index_params().has_value() || !header.get_hnsw_index_params().has_value()) {
46-
LOG(warning, "Cannot use saved HNSW index for ANN, missing index parameters");
4744
return false;
4845
}
4946
const auto &config_params = config.hnsw_index_params().value();
5047
const auto &header_params = header.get_hnsw_index_params().value();
5148
if ((config_params.max_links_per_node() != header_params.max_links_per_node()) ||
52-
(config_params.distance_metric() != header_params.distance_metric()))
53-
{
54-
LOG(warning, "Cannot use saved HNSW index for ANN, index parameters have changed");
49+
(config_params.distance_metric() != header_params.distance_metric())) {
5550
return false;
5651
}
5752
return true;
@@ -263,28 +258,16 @@ TensorAttributeLoader::build_index(vespalib::Executor* executor, uint32_t docid_
263258
std::unique_ptr<IndexBuilder> builder;
264259
if (executor != nullptr) {
265260
builder = std::make_unique<ThreadedIndexBuilder>(_attr, _generation_handler, _store, *_index, *executor);
266-
log_event("hnsw.index.rebuild.start", "execution", "multi-threaded");
267261
} else {
268262
builder = std::make_unique<ForegroundIndexBuilder>(_attr, *_index);
269-
log_event("hnsw.index.rebuild.start", "execution", "single-threaded");
270263
}
271-
constexpr vespalib::duration report_interval = 60s;
272-
auto beforeStamp = vespalib::steady_clock::now();
273-
auto last_report = beforeStamp;
274264
for (uint32_t lid = 0; lid < docid_limit; ++lid) {
275265
auto ref = _ref_vector[lid].load_relaxed();
276266
if (ref.valid()) {
277267
builder->add(lid);
278-
auto now = vespalib::steady_clock::now();
279-
if (last_report + report_interval < now) {
280-
log_event("hnsw.index.rebuild.progress", "percent", (lid * 100.0 / docid_limit));
281-
last_report = now;
282-
}
283268
}
284269
}
285270
builder->wait_complete();
286-
vespalib::duration elapsedTime = vespalib::steady_clock::now() - beforeStamp;
287-
log_event("hnsw.index.rebuild.complete", "time.elapsed.ms", vespalib::count_ms(elapsedTime));
288271
_attr.commit();
289272
}
290273

@@ -374,37 +357,4 @@ TensorAttributeLoader::check_consistency(uint32_t docid_limit)
374357
inconsistencies, _attr.getName().c_str(), elapsed);
375358
}
376359

377-
378-
namespace {
379-
struct EventValue {
380-
vespalib::JSONStringer jstr;
381-
EventValue(const TensorAttribute& attr) : jstr() {
382-
jstr.beginObject();
383-
jstr.appendKey("name").appendString(attr.getName());
384-
}
385-
void addKV(const char* key, const char* value) { jstr.appendKey(key).appendString(value); }
386-
void addKV(const char* key, double value) { jstr.appendKey(key).appendDouble(value); }
387-
const char* message() {
388-
jstr.endObject();
389-
return jstr.str().c_str();
390-
}
391-
};
392-
} // namespace
393-
394-
void TensorAttributeLoader::log_event(const char* eventName) {
395-
EV_STATE(eventName, EventValue(_attr).message());
396-
}
397-
398-
void TensorAttributeLoader::log_event(const char* eventName, const char* key, const char* value) {
399-
EventValue ev(_attr);
400-
ev.addKV(key, value);
401-
EV_STATE(eventName, ev.message());
402360
}
403-
404-
void TensorAttributeLoader::log_event(const char* eventName, const char* key, double value) {
405-
EventValue ev(_attr);
406-
ev.addKV(key, value);
407-
EV_STATE(eventName, ev.message());
408-
}
409-
410-
} // namespace search::tensor

searchlib/src/vespa/searchlib/tensor/tensor_attribute_loader.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ class TensorAttributeLoader {
3636
bool load_index();
3737
uint64_t get_index_size_on_disk();
3838
void check_consistency(uint32_t docid_limit);
39-
void log_event(const char *eventName);
40-
void log_event(const char *eventName, const char *key, const char *value);
41-
void log_event(const char *eventName, const char *key, double value);
4239

4340
public:
4441
TensorAttributeLoader(TensorAttribute& attr, GenerationHandler& generation_handler, RefVector& ref_vector, TensorStore& store, NearestNeighborIndex* index);
@@ -47,3 +44,4 @@ class TensorAttributeLoader {
4744
};
4845

4946
}
47+

0 commit comments

Comments
 (0)