26 namespace foreign_storage {
37 const bool evict_cached_entries) {
44 auto fsm = data_mgr.getPersistentStorageMgr()->getForeignStorageMgr();
46 if (
auto cfm = dynamic_cast<CachingForeignStorageMgr*>(fsm)) {
56 std::map<ChunkKey, std::shared_ptr<ChunkMetadata>> old_chunk_metadata_by_chunk_key;
59 data_mgr.getChunkMetadataVecForKeyPrefix(metadata_vec, table_key);
60 int last_fragment_id = 0;
61 for (
const auto& [key, metadata] : metadata_vec) {
65 old_chunk_metadata_by_chunk_key[key] = metadata;
67 for (
const auto& [key, metadata] : metadata_vec) {
77 fsm->refreshTable(table_key, evict_cached_entries);
89 if (!old_chunk_metadata_by_chunk_key.empty()) {
91 data_mgr.getChunkMetadataVecForKeyPrefix(new_metadata_vec, table_key);
92 for (
const auto& [key, metadata] : new_metadata_vec) {
93 auto it = old_chunk_metadata_by_chunk_key.find(key);
94 if (it != old_chunk_metadata_by_chunk_key.end() &&
95 it->second->numElements != metadata->numElements) {
104 const std::string& table_name,
105 const bool evict_cached_entries) {
112 std::make_unique<lockmgr::TableSchemaLockContainer<lockmgr::WriteLock>>(
114 catalog, table_name,
false));
118 throw std::runtime_error{
120 " is not a foreign table. Refreshes are applicable to only foreign tables."};
123 auto foreign_table =
dynamic_cast<const ForeignTable*
>(td);
124 CHECK(foreign_table);
bool contains(const T &container, const U &element)
std::vector< int > ChunkKey
class for a per-database catalog. also includes metadata for the current database and the current use...
Data_Namespace::DataMgr & getDataMgr() const
#define CHUNK_KEY_FRAGMENT_IDX
void refresh_foreign_table(Catalog_Namespace::Catalog &catalog, const std::string &table_name, const bool evict_cached_entries)
std::runtime_error getOriginalException()
This file contains the class specification and related data structures for Catalog.
const DBMetadata & getCurrentDB() const
#define CHUNK_KEY_TABLE_IDX
int getDatabaseId() const
bool isAppendMode() const
Checks if the table is in append mode.
void deleteChunksWithPrefix(const ChunkKey &keyPrefix)
void removeFragmenterForTable(const int table_id) const
void clear_cpu_and_gpu_cache(Data_Namespace::DataMgr &data_mgr, const ChunkKey &key_prefix)
static void clearExternalCaches(bool for_update, const TableDescriptor *td, const int current_db_id)
static const std::array< std::string, 4 > kAggregatorOnlySystemTables
void refresh_foreign_table_unlocked(Catalog_Namespace::Catalog &catalog, const ForeignTable &td, const bool evict_cached_entries)
static constexpr char const * FOREIGN_TABLE
void updateForeignTableRefreshTimes(const int32_t table_id)