Skip to content

Commit cf020fa

Browse files
authored
chore: tweak logs (#18092)
chore: tweak log validation logs
1 parent ea876d0 commit cf020fa

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

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

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -104,24 +104,26 @@ pub trait Interpreter: Sync + Send {
104104
ctx.set_status_info("[INTERPRETER] Building execution pipeline");
105105
ctx.check_aborting().with_context(make_error)?;
106106

107-
let enable_disk_cache = match LicenseManagerSwitch::instance()
108-
.check_license(ctx.get_license_key())
107+
let mut allow_disk_cache = false;
109108
{
110-
Ok(_) => true,
111-
Err(e) => {
112-
let msg =
113-
format!("[INTERPRETER] CRITICAL ALERT: License validation FAILED - enterprise features DISABLED, System may operate in DEGRADED MODE with LIMITED CAPABILITIES and REDUCED PERFORMANCE. Please contact us at https://www.databend.com/contact-us/ or email hi@databend.com to restore full functionality: {}",
114-
e);
115-
log::error!("{}", msg);
116-
117-
// Also log at warning level to ensure the message could be propagated to client applications
118-
// (e.g., BendSQL and MySQL interactive sessions)
119-
log::warn!("{}", msg);
120-
false
109+
let license_key = ctx.get_license_key();
110+
if !license_key.is_empty() {
111+
let validate_result = LicenseManagerSwitch::instance().check_license(license_key);
112+
allow_disk_cache = validate_result.is_ok();
113+
if let Err(e) = validate_result {
114+
let msg =
115+
format!("[INTERPRETER] CRITICAL ALERT: License validation FAILED - enterprise features DISABLED, System may operate in DEGRADED MODE with LIMITED CAPABILITIES and REDUCED PERFORMANCE. Please contact us at https://www.databend.com/contact-us/ or email hi@databend.com to restore full functionality: {}",
116+
e);
117+
log::error!("{}", msg);
118+
119+
// Also log at warning level to ensure the message could be propagated to client applications
120+
// (e.g., BendSQL and MySQL interactive sessions)
121+
log::warn!("{}", msg);
122+
};
121123
}
122-
};
124+
}
123125

124-
CacheManager::instance().set_allows_disk_cache(enable_disk_cache);
126+
CacheManager::instance().set_allows_disk_cache(allow_disk_cache);
125127

126128
let mut build_res = match self.execute2().await {
127129
Ok(build_res) => build_res,

0 commit comments

Comments
 (0)