1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "fast_access_doc_subdb_configurer.h"
#include "document_subdb_reconfig.h"
#include "i_attribute_writer_factory.h"
#include "documentdbconfig.h"
#include <vespa/searchcore/proton/attribute/attribute_writer.h>
#include <vespa/searchcore/proton/common/document_type_inspector.h>
#include <vespa/searchcore/proton/common/indexschema_inspector.h>
#include <vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.h>
using document::DocumentTypeRepo;
using search::index::Schema;
namespace proton {
using ARIConfig = AttributeReprocessingInitializer::Config;
void
FastAccessDocSubDBConfigurer::reconfigureFeedView(FastAccessFeedView & curr,
Schema::SP schema,
std::shared_ptr<const DocumentTypeRepo> repo,
IAttributeWriter::SP writer)
{
_feedView.set(std::make_shared<FastAccessFeedView>(
StoreOnlyFeedView::Context(curr.getSummaryAdapter(),
std::move(schema),
curr.getDocumentMetaStore(),
std::move(repo),
curr.getUncommittedLidTracker(),
curr.getGidToLidChangeHandler(),
curr.getWriteService()),
curr.getPersistentParams(),
FastAccessFeedView::Context(std::move(writer),curr.getDocIdLimit())));
}
FastAccessDocSubDBConfigurer::FastAccessDocSubDBConfigurer(FeedViewVarHolder &feedView,
IAttributeWriterFactory::UP factory,
const vespalib::string &subDbName)
: _feedView(feedView),
_factory(std::move(factory)),
_subDbName(subDbName)
{
}
FastAccessDocSubDBConfigurer::~FastAccessDocSubDBConfigurer() = default;
std::unique_ptr<const DocumentSubDBReconfig>
FastAccessDocSubDBConfigurer::prepare_reconfig(const DocumentDBConfig& new_config_snapshot, const DocumentDBConfig& old_config_snapshot, const ReconfigParams& reconfig_params)
{
(void) new_config_snapshot;
(void) old_config_snapshot;
(void) reconfig_params;
return std::make_unique<const DocumentSubDBReconfig>(std::shared_ptr<Matchers>());
}
IReprocessingInitializer::UP
FastAccessDocSubDBConfigurer::reconfigure(const DocumentDBConfig &newConfig,
const DocumentDBConfig &oldConfig,
AttributeCollectionSpec && attrSpec,
const DocumentSubDBReconfig& prepared_reconfig)
{
(void) prepared_reconfig;
FastAccessFeedView::SP oldView = _feedView.get();
search::SerialNum currentSerialNum = attrSpec.getCurrentSerialNum();
IAttributeWriter::SP writer = _factory->create(oldView->getAttributeWriter(), std::move(attrSpec));
reconfigureFeedView(*oldView, newConfig.getSchemaSP(), newConfig.getDocumentTypeRepoSP(), writer);
const document::DocumentType *newDocType = newConfig.getDocumentType();
const document::DocumentType *oldDocType = oldConfig.getDocumentType();
assert(newDocType != nullptr);
assert(oldDocType != nullptr);
DocumentTypeInspector inspector(*oldDocType, *newDocType);
IndexschemaInspector oldIndexschemaInspector(oldConfig.getIndexschemaConfig());
return std::make_unique<AttributeReprocessingInitializer>
(ARIConfig(writer->getAttributeManager(), *newConfig.getSchemaSP()),
ARIConfig(oldView->getAttributeWriter()->getAttributeManager(), *oldConfig.getSchemaSP()),
inspector, oldIndexschemaInspector, _subDbName, currentSerialNum);
}
} // namespace proton
|