void AccessRXCache::check_access(const char *filename, bool allow_async, function<void(bool)> cb)
{
+ if (!require_visibility) {
+ cb(true);
+ return;
+ }
+
lock_guard<mutex> lock(mu);
if (engine == nullptr || !engine->get_supports_stat()) {
allow_async = false;
class AccessRXCache {
public:
- AccessRXCache(IOUringEngine *engine)
- : engine(engine) {}
+ AccessRXCache(IOUringEngine *engine, bool require_visibility)
+ : engine(engine), require_visibility(require_visibility) {}
void check_access(const char *filename, bool allow_async, std::function<void(bool)> cb);
private:
std::map<std::string, std::vector<PendingStat>> pending_stats;
IOUringEngine *engine;
std::mutex mu;
+ bool require_visibility;
};
#endif // !defined(_ACCESS_RX_CACHE_H)
uint64_t next_zstd_dictionary_offset_bytes;
uint64_t conf_block_length_bytes;
uint64_t conf_block_offset_bytes;
+
+ // Only if max_version >= 2.
+ bool require_visibility;
};
struct Trigram {
hdr.zstd_dictionary_offset_bytes = 0;
hdr.zstd_dictionary_length_bytes = 0;
}
+ if (hdr.max_version < 2) {
+ // This too. (We ignore the other max_version 2 fields.)
+ hdr.require_visibility = true;
+ }
}
Corpus::~Corpus()
size_t scan_docids(const vector<Needle> &needles, const vector<uint32_t> &docids, const Corpus &corpus, IOUringEngine *engine)
{
Serializer docids_in_order;
- AccessRXCache access_rx_cache(engine);
+ AccessRXCache access_rx_cache(engine, corpus.get_hdr().require_visibility);
atomic<uint64_t> matched{ 0 };
for (size_t i = 0; i < docids.size(); ++i) {
uint32_t docid = docids[i];
}
}
- AccessRXCache access_rx_cache(nullptr);
+ AccessRXCache access_rx_cache(nullptr, corpus.get_hdr().require_visibility);
Serializer serializer;
uint32_t num_blocks = corpus.get_num_filename_blocks();
unique_ptr<uint64_t[]> offsets(new uint64_t[num_blocks + 1]);