OmniSciDB
a5dc49c757
|
#include <HashtableRecycler.h>
Public Member Functions | |
HashtableRecycler (CacheItemType hashtable_type, int num_gpus) | |
void | putItemToCache (QueryPlanHash key, std::shared_ptr< HashTable > item_ptr, CacheItemType item_type, DeviceIdentifier device_identifier, size_t item_size, size_t compute_time, std::optional< HashtableCacheMetaInfo > meta_info=std::nullopt) override |
void | initCache () override |
void | clearCache () override |
void | markCachedItemAsDirty (size_t table_key, std::unordered_set< QueryPlanHash > &key_set, CacheItemType item_type, DeviceIdentifier device_identifier) override |
std::string | toString () const override |
bool | checkHashtableForBoundingBoxIntersectBucketCompatability (const BoundingBoxIntersectMetaInfo &candidate_bucket_dim, const BoundingBoxIntersectMetaInfo &target_bucket_dim) const |
std::tuple< QueryPlanHash, std::shared_ptr< HashTable > , std::optional < HashtableCacheMetaInfo > > | getCachedHashtableWithoutCacheKey (std::set< size_t > &visited, CacheItemType hash_table_type, DeviceIdentifier device_identifier) |
void | addQueryPlanDagForTableKeys (size_t hashed_query_plan_dag, const std::unordered_set< size_t > &table_keys) |
std::optional < std::unordered_set< size_t > > | getMappedQueryPlanDagsWithTableKey (size_t table_key) const |
void | removeTableKeyInfoFromQueryPlanDagMap (size_t table_key) |
Public Member Functions inherited from DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo > | |
DataRecycler (const std::vector< CacheItemType > &item_types, size_t total_cache_size, size_t max_item_size, int num_gpus) | |
virtual | ~DataRecycler ()=default |
virtual std::shared_ptr < HashTable > | getItemFromCache (QueryPlanHash key, CacheItemType item_type, DeviceIdentifier device_identifier, std::optional< HashtableCacheMetaInfo > meta_info=std::nullopt)=0 |
void | markCachedItemAsDirtyImpl (QueryPlanHash key, CachedItemContainer &m) const |
bool | isCachedItemDirty (QueryPlanHash key, CachedItemContainer &m) const |
std::shared_ptr < CachedItemContainer > | getCachedItemContainer (CacheItemType item_type, DeviceIdentifier device_identifier) const |
std::optional< CachedItem < std::shared_ptr< HashTable > , HashtableCacheMetaInfo > > | getCachedItemWithoutConsideringMetaInfo (QueryPlanHash key, CacheItemType item_type, DeviceIdentifier device_identifier, CachedItemContainer &m, std::lock_guard< std::mutex > &lock) |
size_t | getCurrentNumCachedItems (CacheItemType item_type, DeviceIdentifier device_identifier) const |
size_t | getCurrentNumDirtyCachedItems (CacheItemType item_type, DeviceIdentifier device_identifier) const |
size_t | getCurrentNumCleanCachedItems (CacheItemType item_type, DeviceIdentifier device_identifier) const |
size_t | getCurrentCacheSizeForDevice (CacheItemType item_type, DeviceIdentifier device_identifier) const |
std::shared_ptr< CacheItemMetric > | getCachedItemMetric (CacheItemType item_type, DeviceIdentifier device_identifier, QueryPlanHash key) const |
void | setTotalCacheSize (CacheItemType item_type, size_t new_total_cache_size) |
void | setMaxCacheItemSize (CacheItemType item_type, size_t new_max_cache_item_size) |
Static Public Member Functions | |
static HashtableAccessPathInfo | getHashtableAccessPathInfo (const std::vector< InnerOuter > &inner_outer_pairs, const std::vector< InnerOuterStringOpInfos > &inner_outer_string_op_infos_pairs, const SQLOps op_type, const JoinType join_type, const HashTableBuildDagMap &hashtable_build_dag_map, int device_count, int shard_count, const std::vector< std::vector< Fragmenter_Namespace::FragmentInfo >> &frags_for_device, Executor *executor) |
static size_t | getJoinColumnInfoHash (std::vector< const Analyzer::ColumnVar * > &inner_cols, std::vector< const Analyzer::ColumnVar * > &outer_cols, Executor *executor) |
static bool | isSafeToCacheHashtable (const TableIdToNodeMap &table_id_to_node_map, bool need_dict_translation, const std::vector< InnerOuterStringOpInfos > &inner_outer_string_op_info_pairs, const shared::TableKey &table_key) |
static bool | isInvalidHashTableCacheKey (const std::vector< QueryPlanHash > &cache_keys) |
Public Attributes | |
g_hashtable_cache_total_bytes | |
g_max_cacheable_hashtable_size_bytes | |
num_gpus | |
Private Member Functions | |
bool | hasItemInCache (QueryPlanHash key, CacheItemType item_type, DeviceIdentifier device_identifier, std::lock_guard< std::mutex > &lock, std::optional< HashtableCacheMetaInfo > meta_info=std::nullopt) const override |
void | removeItemFromCache (QueryPlanHash key, CacheItemType item_type, DeviceIdentifier device_identifier, std::lock_guard< std::mutex > &lock, std::optional< HashtableCacheMetaInfo > meta_info=std::nullopt) override |
void | cleanupCacheForInsertion (CacheItemType item_type, DeviceIdentifier device_identifier, size_t required_size, std::lock_guard< std::mutex > &lock, std::optional< HashtableCacheMetaInfo > meta_info=std::nullopt) override |
void | removeCachedHashtableBuiltFromSyntheticTable (CacheItemType item_type, DeviceIdentifier device_identifier, std::lock_guard< std::mutex > &lock) |
Private Attributes | |
std::unordered_map< size_t, std::unordered_set< size_t > > | table_key_to_query_plan_dag_map_ |
Definition at line 53 of file HashtableRecycler.h.
|
inline |
Definition at line 56 of file HashtableRecycler.h.
void HashtableRecycler::addQueryPlanDagForTableKeys | ( | size_t | hashed_query_plan_dag, |
const std::unordered_set< size_t > & | table_keys | ||
) |
Definition at line 512 of file HashtableRecycler.cpp.
References DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >::getCacheLock(), and table_key_to_query_plan_dag_map_.
bool HashtableRecycler::checkHashtableForBoundingBoxIntersectBucketCompatability | ( | const BoundingBoxIntersectMetaInfo & | candidate_bucket_dim, |
const BoundingBoxIntersectMetaInfo & | target_bucket_dim | ||
) | const |
Definition at line 333 of file HashtableRecycler.cpp.
References BoundingBoxIntersectMetaInfo::bbox_intersect_bucket_threshold, BoundingBoxIntersectMetaInfo::bbox_intersect_max_table_size_bytes, and BoundingBoxIntersectMetaInfo::bucket_sizes.
Referenced by hasItemInCache(), and putItemToCache().
|
overrideprivatevirtual |
Implements DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >.
Definition at line 206 of file HashtableRecycler.cpp.
References g_is_test_env, DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >::getMetricTracker(), REMOVE, DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >::removeCachedItemFromBeginning(), and DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >::sortCacheContainerByQueryMetric().
Referenced by putItemToCache().
|
overridevirtual |
Implements DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >.
Definition at line 247 of file HashtableRecycler.cpp.
References CacheMetricTracker::clearCacheMetricTracker(), DataRecyclerUtil::CPU_DEVICE_IDENTIFIER, DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >::getCacheItemType(), DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >::getCacheLock(), DataRecyclerUtil::getDeviceIdentifierString(), DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >::getItemCache(), DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >::getMetricTracker(), table_key_to_query_plan_dag_map_, and VLOG.
std::tuple< QueryPlanHash, std::shared_ptr< HashTable >, std::optional< HashtableCacheMetaInfo > > HashtableRecycler::getCachedHashtableWithoutCacheKey | ( | std::set< size_t > & | visited, |
CacheItemType | hash_table_type, | ||
DeviceIdentifier | device_identifier | ||
) |
Definition at line 499 of file HashtableRecycler.cpp.
References EMPTY_HASHED_PLAN_DAG_KEY, DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >::getCachedItemContainer(), and DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >::getCacheLock().
|
static |
Definition at line 417 of file HashtableRecycler.cpp.
References CHECK_GE, CHECK_GT, HashJoin::collectFragmentIds(), EMPTY_HASHED_PLAN_DAG_KEY, getJoinColumnInfoHash(), HashtableAccessPathInfo::hashed_query_plan_dag, kDirect, HashtableAccessPathInfo::table_keys, and toString().
Referenced by PerfectJoinHashTable::reify(), RangeJoinHashTable::reifyWithLayout(), BoundingBoxIntersectJoinHashTable::reifyWithLayout(), and BaselineJoinHashTable::reifyWithLayout().
|
static |
Definition at line 351 of file HashtableRecycler.cpp.
References EMPTY_HASHED_PLAN_DAG_KEY.
Referenced by getHashtableAccessPathInfo().
std::optional< std::unordered_set< size_t > > HashtableRecycler::getMappedQueryPlanDagsWithTableKey | ( | size_t | table_key | ) | const |
Definition at line 523 of file HashtableRecycler.cpp.
References DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >::getCacheLock(), and table_key_to_query_plan_dag_map_.
|
overrideprivatevirtual |
Implements DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >.
Definition at line 21 of file HashtableRecycler.cpp.
References BBOX_INTERSECT_HT, CHECK, checkHashtableForBoundingBoxIntersectBucketCompatability(), EMPTY_HASHED_PLAN_DAG_KEY, g_enable_data_recycler, g_use_hashtable_cache, and DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >::getCachedItemContainer().
Referenced by putItemToCache().
|
inlineoverridevirtual |
Implements DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >.
Definition at line 78 of file HashtableRecycler.h.
|
static |
Definition at line 409 of file HashtableRecycler.cpp.
References anonymous_namespace{QueryMemoryDescriptor.cpp}::any_of(), and EMPTY_HASHED_PLAN_DAG_KEY.
Referenced by PerfectJoinHashTable::reify(), RangeJoinHashTable::reifyWithLayout(), BoundingBoxIntersectJoinHashTable::reifyWithLayout(), and BaselineJoinHashTable::reifyWithLayout().
|
static |
Definition at line 365 of file HashtableRecycler.cpp.
References shared::TableKey::db_id, and shared::TableKey::table_id.
Referenced by PerfectJoinHashTable::initHashTableForDevice(), BaselineJoinHashTable::initHashTableForDevice(), PerfectJoinHashTable::reify(), and BaselineJoinHashTable::reifyWithLayout().
|
overridevirtual |
Implements DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >.
Definition at line 265 of file HashtableRecycler.cpp.
References g_enable_data_recycler, g_use_hashtable_cache, DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >::getCachedItemContainer(), DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >::getCacheLock(), DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >::markCachedItemAsDirtyImpl(), removeCachedHashtableBuiltFromSyntheticTable(), and removeTableKeyInfoFromQueryPlanDagMap().
|
overridevirtual |
Implements DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >.
Definition at line 95 of file HashtableRecycler.cpp.
References AVAILABLE_AFTER_CLEANUP, BBOX_INTERSECT_HT, CHECK, CHECK_EQ, checkHashtableForBoundingBoxIntersectBucketCompatability(), cleanupCacheForInsertion(), EMPTY_HASHED_PLAN_DAG_KEY, g_enable_data_recycler, g_use_hashtable_cache, DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >::getCachedItemContainer(), DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >::getCacheLock(), DataRecyclerUtil::getDeviceIdentifierString(), DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >::getMetricTracker(), hasItemInCache(), logger::INFO, LOG, removeItemFromCache(), UNAVAILABLE, and VLOG.
|
private |
Definition at line 292 of file HashtableRecycler.cpp.
References CHECK, DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >::getCachedItemContainer(), DataRecyclerUtil::getUnitaryTableKey(), removeItemFromCache(), removeTableKeyInfoFromQueryPlanDagMap(), and table_key_to_query_plan_dag_map_.
Referenced by markCachedItemAsDirty().
|
overrideprivatevirtual |
Implements DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >.
Definition at line 171 of file HashtableRecycler.cpp.
References CHECK, EMPTY_HASHED_PLAN_DAG_KEY, g_enable_data_recycler, g_use_hashtable_cache, DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >::getCachedItemContainer(), DataRecyclerUtil::getDeviceIdentifierString(), DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >::getMetricTracker(), REMOVE, and VLOG.
Referenced by putItemToCache(), and removeCachedHashtableBuiltFromSyntheticTable().
void HashtableRecycler::removeTableKeyInfoFromQueryPlanDagMap | ( | size_t | table_key | ) |
Definition at line 530 of file HashtableRecycler.cpp.
References table_key_to_query_plan_dag_map_.
Referenced by markCachedItemAsDirty(), and removeCachedHashtableBuiltFromSyntheticTable().
|
overridevirtual |
Implements DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >.
Definition at line 312 of file HashtableRecycler.cpp.
References DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >::getCacheItemType(), DataRecyclerUtil::getDeviceIdentifierString(), DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >::getItemCache(), and DataRecycler< std::shared_ptr< HashTable >, HashtableCacheMetaInfo >::getMetricTracker().
Referenced by getHashtableAccessPathInfo().
HashtableRecycler::g_hashtable_cache_total_bytes |
Definition at line 57 of file HashtableRecycler.h.
HashtableRecycler::g_max_cacheable_hashtable_size_bytes |
Definition at line 57 of file HashtableRecycler.h.
HashtableRecycler::num_gpus |
Definition at line 60 of file HashtableRecycler.h.
|
private |
Definition at line 173 of file HashtableRecycler.h.
Referenced by addQueryPlanDagForTableKeys(), clearCache(), getMappedQueryPlanDagsWithTableKey(), removeCachedHashtableBuiltFromSyntheticTable(), and removeTableKeyInfoFromQueryPlanDagMap().