mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
Merge pull request #22365 from ClickHouse/aku/processes-database
add current database to system.processes
This commit is contained in:
commit
59c158300a
@ -455,7 +455,10 @@ QueryStatusInfo QueryStatus::getInfo(bool get_thread_list, bool get_profile_even
|
||||
}
|
||||
|
||||
if (get_settings && query_context)
|
||||
{
|
||||
res.query_settings = std::make_shared<Settings>(query_context->getSettings());
|
||||
res.current_database = query_context->getCurrentDatabase();
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -68,6 +68,7 @@ struct QueryStatusInfo
|
||||
std::vector<UInt64> thread_ids;
|
||||
std::shared_ptr<ProfileEvents::Counters> profile_counters;
|
||||
std::shared_ptr<Settings> query_settings;
|
||||
std::string current_database;
|
||||
};
|
||||
|
||||
/// Query and information about its execution.
|
||||
|
@ -64,6 +64,8 @@ NamesAndTypesList StorageSystemProcesses::getNamesAndTypes()
|
||||
{"ProfileEvents.Values", std::make_shared<DataTypeArray>(std::make_shared<DataTypeUInt64>())},
|
||||
{"Settings.Names", std::make_shared<DataTypeArray>(std::make_shared<DataTypeString>())},
|
||||
{"Settings.Values", std::make_shared<DataTypeArray>(std::make_shared<DataTypeString>())},
|
||||
|
||||
{"current_database", std::make_shared<DataTypeString>()},
|
||||
};
|
||||
}
|
||||
|
||||
@ -149,6 +151,8 @@ void StorageSystemProcesses::fillData(MutableColumns & res_columns, const Contex
|
||||
column_settings_values->insertDefault();
|
||||
}
|
||||
}
|
||||
|
||||
res_columns[i++]->insert(process.current_database);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ echo '5.1'
|
||||
|
||||
# wait until the query in background will start (max: 10 seconds as sleepEachRow)
|
||||
for _ in {1..100}; do
|
||||
$CLICKHOUSE_CLIENT --query="SHOW PROCESSLIST" --log_queries=0 >"$tmp_file" 2>&1
|
||||
$CLICKHOUSE_CLIENT --query="SELECT * FROM system.processes WHERE current_database = currentDatabase()" --log_queries=0 >"$tmp_file" 2>&1
|
||||
grep -q -F 'fwerkh_that_magic_string_make_me_unique' "$tmp_file" && break
|
||||
sleep 0.1
|
||||
done
|
||||
@ -118,8 +118,8 @@ $CLICKHOUSE_CLIENT --query="SYSTEM FLUSH LOGS" --server_logs_file=/dev/null
|
||||
echo 9
|
||||
$CLICKHOUSE_CLIENT \
|
||||
--server_logs_file=/dev/null \
|
||||
--query="SELECT if( count() > 0, 'text_log non empty', 'text_log empty') FROM system.text_log WHERE event_time>now() - 60 and message like '%find_me%';
|
||||
select * from system.text_log where event_time > now() - 60 and message like '%TOPSECRET=TOPSECRET%';" --ignore-error --multiquery
|
||||
--query="SELECT if( count() > 0, 'text_log non empty', 'text_log empty') FROM system.text_log WHERE event_date >= yesterday() and message like '%find_me%';
|
||||
select * from system.text_log where event_date >= yesterday() and message like '%TOPSECRET=TOPSECRET%';" --ignore-error --multiquery
|
||||
|
||||
echo 'finish'
|
||||
rm -f "$tmp_file" >/dev/null 2>&1
|
||||
|
@ -0,0 +1 @@
|
||||
1
|
@ -0,0 +1 @@
|
||||
select count(*) from system.processes where current_database = currentDatabase();
|
Loading…
Reference in New Issue
Block a user