MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / tryGetTableFromCache

Method tryGetTableFromCache

src/Databases/DatabaseFilesystem.cpp:116–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116StoragePtr DatabaseFilesystem::tryGetTableFromCache(const std::string & name) const
117{
118 StoragePtr table = nullptr;
119 {
120 std::lock_guard lock(mutex);
121 auto it = loaded_tables.find(name);
122 if (it != loaded_tables.end())
123 table = it->second;
124 }
125
126 /// Invalidate cache if file no longer exists.
127 if (table && !fs::exists(getTablePath(name)))
128 {
129 std::lock_guard lock(mutex);
130 loaded_tables.erase(name);
131 return nullptr;
132 }
133
134 return table;
135}
136
137bool DatabaseFilesystem::isTableExist(const String & name, ContextPtr context_) const
138{

Callers

nothing calls this directly

Calls 5

getTablePathFunction · 0.85
existsFunction · 0.50
findMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected