blob: e05fda7966c8151c1bb4c3d3e444c827fe6314e0 (
plain) (
blame)
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "attributes_initializer_base.h"
#include "attributemanager.h"
#include <vespa/searchlib/attribute/attributevector.h>
#include <cassert>
namespace proton {
void
AttributesInitializerBase::considerPadAttribute(search::AttributeVector &attribute,
std::optional<search::SerialNum> currentSerialNum,
uint32_t newDocIdLimit)
{
/*
* Sizing requirements for other components to work with the
* new attributes vectors:
*
* Document meta store doesn't need to be resized here ever.
* It is always present and is the authorative source for
* allocation of new lids after replay of transaction log has
* completed. The transaction log should never be pruned
* beyond the last saved version of the document meta store,
* and the document meta store will grow as needed during
* replay unless the transaction log is corrupted.
*
* If a newly loaded attribute vector is shorter than the
* document meta store then it needs to be padded upwards to
* the same size to ensure that further operations will work.
* This is not needed if the system has never performed any
* reconfiguration introducing/removing attribute vectors,
* i.e. if the newest saved config is still at serial number
* 1, since a replay of a non-corrupted transaction log should
* grow the attribute as needed.
*/
if (!currentSerialNum.has_value() ||
attribute.getStatus().getLastSyncToken() < currentSerialNum.value()) {
AttributeManager::padAttribute(attribute, newDocIdLimit);
attribute.commit();
assert(newDocIdLimit <= attribute.getNumDocs());
}
}
AttributesInitializerBase::AttributesInitializerBase()
: IAttributeInitializerRegistry(),
_initializedAttributes()
{
}
} // namespace proton
|