|
13 | 13 | #include <vespa/searchlib/attribute/load_utils.h>
|
14 | 14 | #include <vespa/searchlib/attribute/readerbase.h>
|
15 | 15 | #include <vespa/searchlib/util/disk_space_calculator.h>
|
16 |
| -#include <vespa/vespalib/objects/nbostream.h> |
17 | 16 | #include <vespa/vespalib/util/arrayqueue.hpp>
|
18 | 17 | #include <vespa/vespalib/util/cpu_usage.h>
|
19 |
| -#include <vespa/vespalib/util/jsonwriter.h> |
20 | 18 | #include <vespa/vespalib/util/lambdatask.h>
|
21 |
| -#include <vespa/vespalib/util/time.h> |
| 19 | +#include <vespa/vespalib/objects/nbostream.h> |
22 | 20 | #include <condition_variable>
|
23 | 21 | #include <filesystem>
|
24 | 22 | #include <mutex>
|
|
43 | 41 | can_use_index_save_file(const search::attribute::Config &config, const AttributeHeader& header)
|
44 | 42 | {
|
45 | 43 | 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"); |
47 | 44 | return false;
|
48 | 45 | }
|
49 | 46 | const auto &config_params = config.hnsw_index_params().value();
|
50 | 47 | const auto &header_params = header.get_hnsw_index_params().value();
|
51 | 48 | 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())) { |
55 | 50 | return false;
|
56 | 51 | }
|
57 | 52 | return true;
|
@@ -263,28 +258,16 @@ TensorAttributeLoader::build_index(vespalib::Executor* executor, uint32_t docid_
|
263 | 258 | std::unique_ptr<IndexBuilder> builder;
|
264 | 259 | if (executor != nullptr) {
|
265 | 260 | builder = std::make_unique<ThreadedIndexBuilder>(_attr, _generation_handler, _store, *_index, *executor);
|
266 |
| - log_event("hnsw.index.rebuild.start", "execution", "multi-threaded"); |
267 | 261 | } else {
|
268 | 262 | builder = std::make_unique<ForegroundIndexBuilder>(_attr, *_index);
|
269 |
| - log_event("hnsw.index.rebuild.start", "execution", "single-threaded"); |
270 | 263 | }
|
271 |
| - constexpr vespalib::duration report_interval = 60s; |
272 |
| - auto beforeStamp = vespalib::steady_clock::now(); |
273 |
| - auto last_report = beforeStamp; |
274 | 264 | for (uint32_t lid = 0; lid < docid_limit; ++lid) {
|
275 | 265 | auto ref = _ref_vector[lid].load_relaxed();
|
276 | 266 | if (ref.valid()) {
|
277 | 267 | 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 |
| - } |
283 | 268 | }
|
284 | 269 | }
|
285 | 270 | 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)); |
288 | 271 | _attr.commit();
|
289 | 272 | }
|
290 | 273 |
|
@@ -374,37 +357,4 @@ TensorAttributeLoader::check_consistency(uint32_t docid_limit)
|
374 | 357 | inconsistencies, _attr.getName().c_str(), elapsed);
|
375 | 358 | }
|
376 | 359 |
|
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()); |
402 | 360 | }
|
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 |
0 commit comments