19 #include <shared_mutex>
25 using namespace Data_Namespace;
27 namespace Catalog_Namespace {
37 : std::runtime_error(
""), original_exception_(exception){};
45 namespace foreign_storage {
56 void throwChunkSizeViolatedError(
const int64_t actual_chunk_size,
57 const int column_id = -1)
const;
62 std::shared_ptr<Catalog_Namespace::Catalog>
catalog_;
72 virtual void setParentWrapper(
73 std::shared_ptr<ForeignDataWrapper> parent_data_wrapper) = 0;
75 virtual void unsetParentWrapper() = 0;
85 const size_t page_size,
86 const size_t initial_size)
override;
87 void deleteBuffer(
const ChunkKey& chunk_key,
const bool purge)
override;
88 void deleteBuffersWithPrefix(
const ChunkKey& chunk_key_prefix,
89 const bool purge)
override;
91 void fetchBuffer(
const ChunkKey& chunk_key,
93 const size_t num_bytes)
override;
96 const size_t num_bytes)
override;
102 const ChunkKey& chunk_key_prefix)
override;
103 bool isBufferOnDevice(
const ChunkKey& chunk_key)
override;
104 std::string printSlabs()
override;
105 size_t getMaxSize()
override;
106 size_t getInUseSize()
override;
107 size_t getAllocated()
override;
108 bool isAllocationCapped()
override;
109 void checkpoint()
override;
110 void checkpoint(
const int db_id,
const int tb_id)
override;
113 MgrType getMgrType()
override;
114 std::string getStringMgrType()
override;
115 size_t getNumChunks()
override;
116 void removeTableRelatedDS(
const int db_id,
const int table_id)
override;
117 bool hasDataWrapperForChunk(
const ChunkKey& chunk_key)
const;
118 virtual bool createDataWrapperIfNotExists(
const ChunkKey& chunk_key);
121 bool isDatawrapperRestored(
const ChunkKey& chunk_key);
122 void setDataWrapper(
const ChunkKey& table_key,
123 std::shared_ptr<MockForeignDataWrapper> data_wrapper);
124 std::shared_ptr<ForeignDataWrapper> getDataWrapper(
const ChunkKey& chunk_key)
const;
126 virtual void refreshTable(
const ChunkKey& table_key,
const bool evict_cached_entries);
129 void setParallelismHints(
130 const std::map<
ChunkKey, std::set<ParallelismHint>>& hints_per_table);
131 virtual size_t maxFetchSize(int32_t db_id)
const;
132 virtual bool hasMaxFetchSize()
const;
135 virtual void eraseDataWrapper(
const ChunkKey& table_key);
137 void createDataWrapperUnlocked(int32_t db, int32_t tb);
138 bool fetchBufferIfTempBufferMapEntryExists(
const ChunkKey& chunk_key,
140 const size_t num_bytes);
141 ChunkToBufferMap allocateTempBuffersForChunks(
const std::set<ChunkKey>& chunk_keys);
142 void clearTempChunkBufferMapEntriesForTable(
const ChunkKey& table_key);
143 void clearTempChunkBufferMapEntriesForTableUnlocked(
const ChunkKey& table_key);
145 std::set<ChunkKey> getOptionalChunkKeySetAndNormalizeCache(
147 const std::set<ChunkKey>& required_chunk_keys,
150 std::pair<std::set<ChunkKey, decltype(set_comp)*>,
151 std::set<ChunkKey, decltype(set_comp)*>>
152 getPrefetchSets(
const ChunkKey& chunk_key,
153 const std::set<ChunkKey>& required_chunk_keys,
156 virtual std::set<ChunkKey> getOptionalKeysWithinSizeLimit(
161 virtual bool isChunkCached(
const ChunkKey& chunk_key)
const;
163 virtual void evictChunkFromCache(
const ChunkKey& chunk_key);
165 static void checkIfS3NeedsToBeEnabled(
const ChunkKey& chunk_key);
bool set_comp(const ChunkKey &left, const ChunkKey &right)
std::vector< int > ChunkKey
std::pair< int, int > ParallelismHint
std::map< ChunkKey, AbstractBuffer * > ChunkToBufferMap
std::shared_ptr< Catalog_Namespace::Catalog > catalog_
bool is_append_table_chunk_key(const ChunkKey &chunk_key)
std::set< ChunkKey > get_column_key_set(const ChunkKey &destination_chunk_key)
const ColumnDescriptor * column_
std::runtime_error getOriginalException()
bool is_table_enabled_on_node(const ChunkKey &key)
std::shared_mutex parallelism_hints_mutex_
PostEvictionRefreshException(const std::runtime_error &exception)
bool contains_fragment_key(const std::set< ChunkKey > &key_set, const ChunkKey &target_key)
std::shared_mutex temp_chunk_buffer_map_mutex_
std::map< ChunkKey, std::set< ParallelismHint > > parallelism_hints_per_table_
An AbstractBuffer is a unit of data management for a data manager.
specifies the content in-memory of a row in the column metadata table
const ForeignTable * foreign_table_
~ForeignStorageMgr() override
std::map< ChunkKey, std::shared_ptr< ForeignDataWrapper > > data_wrapper_map_
size_t get_max_chunk_size(const ChunkKey &key)
std::runtime_error original_exception_
std::map< ChunkKey, std::shared_ptr< MockForeignDataWrapper > > mocked_wrapper_map_
std::map< ChunkKey, std::unique_ptr< AbstractBuffer > > temp_chunk_buffer_map_
std::shared_timed_mutex shared_mutex
std::vector< ChunkKey > get_column_key_vec(const ChunkKey &destination_chunk_key)
std::shared_mutex data_wrapper_mutex_