Skip to content

Commit 56b0181

Browse files
authored
chore: check ee license for disk cache (#17749)
* chore: check ee license for disk cache * chore: add license checks * revert method renaming * Tweak comments * Relaxed * chore: remove new method from LicenseManager & fmt & clippy * Uses new License Manager api
1 parent aff1c80 commit 56b0181

File tree

9 files changed

+345
-62
lines changed

9 files changed

+345
-62
lines changed

src/query/config/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ pub use inner::CacheConfig;
4949
pub use inner::CacheStorageTypeConfig as CacheStorageTypeInnerConfig;
5050
pub use inner::CatalogConfig;
5151
pub use inner::CatalogHiveConfig;
52+
pub use inner::DiskCacheConfig as DiskCacheInnerConfig;
5253
pub use inner::DiskCacheKeyReloadPolicy;
5354
pub use inner::InnerConfig;
5455
pub use inner::SpillConfig;

src/query/service/src/global_services.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ impl GlobalServices {
151151
&config.cache,
152152
&config.query.max_server_memory_usage,
153153
config.query.tenant_id.tenant_name().to_string(),
154+
ee_mode,
154155
)?;
155156
TempDirManager::init(&config.spill, config.query.tenant_id.tenant_name())?;
156157

src/query/service/src/interpreters/interpreter.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ use databend_common_exception::ErrorCode;
3333
use databend_common_exception::Result;
3434
use databend_common_exception::ResultExt;
3535
use databend_common_expression::SendableDataBlockStream;
36+
use databend_common_license::license_manager::LicenseManagerSwitch;
3637
use databend_common_pipeline_core::always_callback;
3738
use databend_common_pipeline_core::processors::PlanProfile;
3839
use databend_common_pipeline_core::ExecutionInfo;
@@ -42,6 +43,7 @@ use databend_common_sql::PlanExtras;
4243
use databend_common_sql::Planner;
4344
use databend_common_storages_system::ProfilesLogElement;
4445
use databend_common_storages_system::ProfilesLogQueue;
46+
use databend_storages_common_cache::CacheManager;
4547
use derive_visitor::DriveMut;
4648
use derive_visitor::VisitorMut;
4749
use log::error;
@@ -101,6 +103,10 @@ pub trait Interpreter: Sync + Send {
101103
ctx.set_status_info("building pipeline");
102104
ctx.check_aborting().with_context(make_error)?;
103105

106+
CacheManager::instance().set_allows_disk_cache(
107+
LicenseManagerSwitch::instance().is_license_valid(ctx.get_license_key()),
108+
);
109+
104110
let mut build_res = match self.execute2().await {
105111
Ok(build_res) => build_res,
106112
Err(err) => {

src/query/storages/common/cache/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ pub use caches::SizedColumnArray;
3333
pub use manager::CacheManager;
3434
// Unfortunately, criterion benchmarks need it to be pub
3535
pub use providers::disk_cache::disk_cache_lru::read_cache_content;
36+
pub use providers::DiskCacheAccessor;
3637
pub use providers::DiskCacheBuilder;
3738
pub use providers::DiskCacheError;
3839
pub use providers::DiskCacheKey;
@@ -42,7 +43,6 @@ pub use providers::InMemoryLruCache;
4243
pub use providers::LruDiskCache;
4344
pub use providers::LruDiskCacheBuilder;
4445
pub use providers::LruDiskCacheHolder;
45-
pub use providers::TableDataCache;
4646
pub use providers::TableDataCacheKey;
4747
pub use read::CacheKey;
4848
pub use read::CachedReader;

0 commit comments

Comments
 (0)