OmniSciDB
a5dc49c757
|
#include <ResultSetRecycler.h>
Public Member Functions | |
ResultSetRecycler () | |
std::optional< std::vector < TargetMetaInfo > > | getOutputMetaInfo (QueryPlanHash key) |
void | putItemToCache (QueryPlanHash key, ResultSetPtr item_ptr, CacheItemType item_type, DeviceIdentifier device_identifier, size_t item_size, size_t compute_time, std::optional< ResultSetMetaInfo > 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 |
std::tuple< QueryPlanHash, ResultSetPtr, std::optional < ResultSetMetaInfo > > | getCachedResultSetWithoutCacheKey (std::set< size_t > &visited, DeviceIdentifier device_identifier) |
void | addQueryPlanDagForTableKeys (size_t hashed_query_plan_dag, const std::unordered_set< size_t > &table_keys, std::lock_guard< std::mutex > &lock) |
std::optional < std::unordered_set< size_t > > | getMappedQueryPlanDagsWithTableKey (size_t table_key) const |
void | removeTableKeyInfoFromQueryPlanDagMap (size_t table_key) |
bool | hasItemInCache (QueryPlanHash key) |
std::vector< std::shared_ptr < Analyzer::Expr > > & | getTargetExprs (QueryPlanHash key) const |
CacheMetricTracker & | getResultSetRecyclerMetricTracker () |
Public Member Functions inherited from DataRecycler< ResultSetPtr, ResultSetMetaInfo > | |
DataRecycler (const std::vector< CacheItemType > &item_types, size_t total_cache_size, size_t max_item_size, int num_gpus) | |
virtual | ~DataRecycler ()=default |
virtual ResultSetPtr | getItemFromCache (QueryPlanHash key, CacheItemType item_type, DeviceIdentifier device_identifier, std::optional< ResultSetMetaInfo > 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 < ResultSetPtr, ResultSetMetaInfo > > | 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) |
Public Attributes | |
g_query_resultset_cache_total_bytes | |
g_max_cacheable_query_resultset_size_bytes | |
Private Member Functions | |
bool | hasItemInCache (QueryPlanHash key, CacheItemType item_type, DeviceIdentifier device_identifier, std::lock_guard< std::mutex > &lock, std::optional< ResultSetMetaInfo > meta_info=std::nullopt) const override |
void | removeItemFromCache (QueryPlanHash key, CacheItemType item_type, DeviceIdentifier device_identifier, std::lock_guard< std::mutex > &lock, std::optional< ResultSetMetaInfo > 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< ResultSetMetaInfo > meta_info=std::nullopt) override |
Private Attributes | |
std::unordered_map< size_t, std::unordered_set< size_t > > | table_key_to_query_plan_dag_map_ |
Definition at line 40 of file ResultSetRecycler.h.
|
inline |
Definition at line 42 of file ResultSetRecycler.h.
void ResultSetRecycler::addQueryPlanDagForTableKeys | ( | size_t | hashed_query_plan_dag, |
const std::unordered_set< size_t > & | table_keys, | ||
std::lock_guard< std::mutex > & | lock | ||
) |
Definition at line 344 of file ResultSetRecycler.cpp.
References table_key_to_query_plan_dag_map_.
Referenced by putItemToCache().
|
overrideprivatevirtual |
Implements DataRecycler< ResultSetPtr, ResultSetMetaInfo >.
Definition at line 236 of file ResultSetRecycler.cpp.
References g_is_test_env, DataRecycler< ResultSetPtr, ResultSetMetaInfo >::getMetricTracker(), REMOVE, DataRecycler< ResultSetPtr, ResultSetMetaInfo >::removeCachedItemFromBeginning(), and DataRecycler< ResultSetPtr, ResultSetMetaInfo >::sortCacheContainerByQueryMetric().
Referenced by putItemToCache().
|
overridevirtual |
Implements DataRecycler< ResultSetPtr, ResultSetMetaInfo >.
Definition at line 276 of file ResultSetRecycler.cpp.
References CacheMetricTracker::clearCacheMetricTracker(), DataRecyclerUtil::CPU_DEVICE_IDENTIFIER, DataRecycler< ResultSetPtr, ResultSetMetaInfo >::getCacheItemType(), DataRecycler< ResultSetPtr, ResultSetMetaInfo >::getCacheLock(), DataRecyclerUtil::getDeviceIdentifierString(), DataRecycler< ResultSetPtr, ResultSetMetaInfo >::getItemCache(), DataRecycler< ResultSetPtr, ResultSetMetaInfo >::getMetricTracker(), table_key_to_query_plan_dag_map_, and VLOG.
std::tuple< QueryPlanHash, ResultSetPtr, std::optional< ResultSetMetaInfo > > ResultSetRecycler::getCachedResultSetWithoutCacheKey | ( | std::set< size_t > & | visited, |
DeviceIdentifier | device_identifier | ||
) |
Definition at line 331 of file ResultSetRecycler.cpp.
References EMPTY_HASHED_PLAN_DAG_KEY, DataRecycler< ResultSetPtr, ResultSetMetaInfo >::getCachedItemContainer(), DataRecycler< ResultSetPtr, ResultSetMetaInfo >::getCacheLock(), and QUERY_RESULTSET.
std::optional< std::unordered_set< size_t > > ResultSetRecycler::getMappedQueryPlanDagsWithTableKey | ( | size_t | table_key | ) | const |
Definition at line 355 of file ResultSetRecycler.cpp.
References DataRecycler< ResultSetPtr, ResultSetMetaInfo >::getCacheLock(), and table_key_to_query_plan_dag_map_.
std::optional< std::vector< TargetMetaInfo > > ResultSetRecycler::getOutputMetaInfo | ( | QueryPlanHash | key | ) |
Definition at line 92 of file ResultSetRecycler.cpp.
References CHECK, DataRecyclerUtil::CPU_DEVICE_IDENTIFIER, EMPTY_HASHED_PLAN_DAG_KEY, g_enable_data_recycler, g_use_query_resultset_cache, DataRecycler< ResultSetPtr, ResultSetMetaInfo >::getCachedItemContainer(), DataRecycler< ResultSetPtr, ResultSetMetaInfo >::getCacheLock(), QUERY_RESULTSET, and removeItemFromCache().
|
inline |
Definition at line 93 of file ResultSetRecycler.h.
References DataRecycler< ResultSetPtr, ResultSetMetaInfo >::getMetricTracker(), and QUERY_RESULTSET.
std::vector< std::shared_ptr< Analyzer::Expr > > & ResultSetRecycler::getTargetExprs | ( | QueryPlanHash | key | ) | const |
Definition at line 366 of file ResultSetRecycler.cpp.
References CHECK, DataRecyclerUtil::CPU_DEVICE_IDENTIFIER, DataRecycler< ResultSetPtr, ResultSetMetaInfo >::getCachedItemContainer(), DataRecycler< ResultSetPtr, ResultSetMetaInfo >::getCacheLock(), and QUERY_RESULTSET.
bool ResultSetRecycler::hasItemInCache | ( | QueryPlanHash | key | ) |
Definition at line 39 of file ResultSetRecycler.cpp.
References DataRecyclerUtil::CPU_DEVICE_IDENTIFIER, DataRecycler< ResultSetPtr, ResultSetMetaInfo >::getCacheLock(), and QUERY_RESULTSET.
|
overrideprivatevirtual |
Implements DataRecycler< ResultSetPtr, ResultSetMetaInfo >.
Definition at line 21 of file ResultSetRecycler.cpp.
References CHECK, EMPTY_HASHED_PLAN_DAG_KEY, g_enable_data_recycler, g_use_query_resultset_cache, and DataRecycler< ResultSetPtr, ResultSetMetaInfo >::getCachedItemContainer().
|
inlineoverridevirtual |
Implements DataRecycler< ResultSetPtr, ResultSetMetaInfo >.
Definition at line 65 of file ResultSetRecycler.h.
|
overridevirtual |
Implements DataRecycler< ResultSetPtr, ResultSetMetaInfo >.
Definition at line 294 of file ResultSetRecycler.cpp.
References g_enable_data_recycler, g_use_query_resultset_cache, DataRecycler< ResultSetPtr, ResultSetMetaInfo >::getCachedItemContainer(), DataRecycler< ResultSetPtr, ResultSetMetaInfo >::getCacheLock(), removeItemFromCache(), and removeTableKeyInfoFromQueryPlanDagMap().
|
overridevirtual |
Implements DataRecycler< ResultSetPtr, ResultSetMetaInfo >.
Definition at line 123 of file ResultSetRecycler.cpp.
References addQueryPlanDagForTableKeys(), AVAILABLE_AFTER_CLEANUP, CHECK, CHECK_EQ, CHECK_GT, cleanupCacheForInsertion(), EMPTY_HASHED_PLAN_DAG_KEY, g_enable_data_recycler, g_max_cacheable_query_resultset_size_bytes, g_query_resultset_cache_total_bytes, g_use_query_resultset_cache, DataRecycler< ResultSetPtr, ResultSetMetaInfo >::getCachedItemContainer(), DataRecycler< ResultSetPtr, ResultSetMetaInfo >::getCacheLock(), DataRecyclerUtil::getDeviceIdentifierString(), DataRecycler< ResultSetPtr, ResultSetMetaInfo >::getMetricTracker(), logger::INFO, LOG, removeItemFromCache(), UNAVAILABLE, and VLOG.
|
overrideprivatevirtual |
Implements DataRecycler< ResultSetPtr, ResultSetMetaInfo >.
Definition at line 204 of file ResultSetRecycler.cpp.
References CHECK, EMPTY_HASHED_PLAN_DAG_KEY, g_enable_data_recycler, g_use_query_resultset_cache, DataRecycler< ResultSetPtr, ResultSetMetaInfo >::getCachedItemContainer(), DataRecyclerUtil::getDeviceIdentifierString(), DataRecycler< ResultSetPtr, ResultSetMetaInfo >::getMetricTracker(), REMOVE, and VLOG.
Referenced by getOutputMetaInfo(), markCachedItemAsDirty(), and putItemToCache().
void ResultSetRecycler::removeTableKeyInfoFromQueryPlanDagMap | ( | size_t | table_key | ) |
Definition at line 362 of file ResultSetRecycler.cpp.
References table_key_to_query_plan_dag_map_.
Referenced by markCachedItemAsDirty().
|
overridevirtual |
Implements DataRecycler< ResultSetPtr, ResultSetMetaInfo >.
Definition at line 309 of file ResultSetRecycler.cpp.
References DataRecycler< ResultSetPtr, ResultSetMetaInfo >::getCacheItemType(), DataRecyclerUtil::getDeviceIdentifierString(), DataRecycler< ResultSetPtr, ResultSetMetaInfo >::getItemCache(), and DataRecycler< ResultSetPtr, ResultSetMetaInfo >::getMetricTracker().
ResultSetRecycler::g_max_cacheable_query_resultset_size_bytes |
Definition at line 43 of file ResultSetRecycler.h.
Referenced by putItemToCache().
ResultSetRecycler::g_query_resultset_cache_total_bytes |
Definition at line 43 of file ResultSetRecycler.h.
Referenced by putItemToCache().
|
private |
Definition at line 120 of file ResultSetRecycler.h.
Referenced by addQueryPlanDagForTableKeys(), clearCache(), getMappedQueryPlanDagsWithTableKey(), and removeTableKeyInfoFromQueryPlanDagMap().