blob: 4717c42121f1a39e461c809a7d20cb595beb7e2a (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vector>
#include <cstdint>
namespace searchcorespi::index { struct IThreadingService; }
namespace proton::documentmetastore {
struct IStore;
/**
* This class delays reuse of lids until references to the lids have
* been purged from the data structures in memory index and attribute
* vectors.
*
* Note that an additional delay is added by the IStore component,
* where lids are put on a hold list to ensure that queries started
* before lid was purged also blocks reuse of lid.
*
* Currently only works correctly when visibility delay is 0.
*/
class LidReuseDelayer
{
searchcorespi::index::IThreadingService &_writeService;
IStore &_documentMetaStore;
std::vector<uint32_t> _pendingLids; // lids waiting for commit
public:
LidReuseDelayer(searchcorespi::index::IThreadingService &writeService, IStore &documentMetaStore);
~LidReuseDelayer();
void delayReuse(uint32_t lid);
void delayReuse(const std::vector<uint32_t> &lids);
std::vector<uint32_t> getReuseLids();
};
}
|