mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-19 16:20:50 +00:00
Add one more comment, better cache policy randomizer
This commit is contained in:
parent
4940162959
commit
fd7c732c12
@ -25,7 +25,7 @@ azurite-blob --blobHost 0.0.0.0 --blobPort 10000 --debug /azurite_log &
|
||||
config_logs_export_cluster /etc/clickhouse-server/config.d/system_logs_export.yaml
|
||||
|
||||
cache_policy=""
|
||||
if [ $(( $(date +%-d) % 2 )) -eq 1 ]; then
|
||||
if [ $(($RANDOM%2)) -eq 1 ]; then
|
||||
cache_policy="SLRU"
|
||||
else
|
||||
cache_policy="LRU"
|
||||
@ -33,12 +33,12 @@ fi
|
||||
|
||||
echo "Using cache policy: $cache_policy"
|
||||
|
||||
#if [ "$cache_policy" = "SLRU" ]; then
|
||||
# sudo cat /etc/clickhouse-server/config.d/storage_conf.xml \
|
||||
# | sed "s|<cache_policy>LRU</cache_policy>|<cache_policy>SLRU</cache_policy>|" \
|
||||
# > /etc/clickhouse-server/config.d/storage_conf.xml.tmp
|
||||
# mv /etc/clickhouse-server/config.d/storage_conf.xml.tmp /etc/clickhouse-server/config.d/storage_conf.xml
|
||||
#fi
|
||||
if [ "$cache_policy" = "SLRU" ]; then
|
||||
sudo cat /etc/clickhouse-server/config.d/storage_conf.xml \
|
||||
| sed "s|<cache_policy>LRU</cache_policy>|<cache_policy>SLRU</cache_policy>|" \
|
||||
> /etc/clickhouse-server/config.d/storage_conf.xml.tmp
|
||||
mv /etc/clickhouse-server/config.d/storage_conf.xml.tmp /etc/clickhouse-server/config.d/storage_conf.xml
|
||||
fi
|
||||
|
||||
if [[ -n "$USE_S3_STORAGE_FOR_MERGE_TREE" ]] && [[ "$USE_S3_STORAGE_FOR_MERGE_TREE" -eq 1 ]]; then
|
||||
# It is not needed, we will explicitly create tables on s3.
|
||||
|
@ -867,7 +867,7 @@ bool FileCache::tryReserve(
|
||||
/// then we need to make sure that this fact that we fit in cache by size
|
||||
/// remains true after we release the lock and take it again.
|
||||
/// For this purpose we create a HoldSpace holder which makes sure that the space is hold in the meantime.
|
||||
/// We substract reserve_stat.stat.releasable_size from the hold space,
|
||||
/// We subtract reserve_stat.stat.releasable_size from the hold space,
|
||||
/// because it is the space that will be released, so we do not need to take it into account.
|
||||
const size_t hold_size = reached_size_limit
|
||||
? size > reserve_stat.stat.releasable_size ? size - reserve_stat.stat.releasable_size : 0
|
||||
|
@ -41,6 +41,15 @@ public:
|
||||
|
||||
bool isEvicting(const CachePriorityGuard::Lock &) const { return evicting; }
|
||||
bool isEvicting(const LockedKey &) const { return evicting; }
|
||||
/// This does not look good to have isEvicting with two options for locks,
|
||||
/// but still it is valid as we do setEvicting always under both of them.
|
||||
/// (Well, not always - only always for setting it to True,
|
||||
/// but for False we have lower guarantees and allow a logical race,
|
||||
/// physical race is not possible because the value is atomic).
|
||||
/// We can avoid this ambiguity for isEvicting by introducing
|
||||
/// a separate lock `EntryGuard::Lock`, it will make this part of code more coherent,
|
||||
/// but it will introduce one more mutex while it is avoidable.
|
||||
/// Introducing one more mutex just for coherency does not win the trade-off (isn't it?).
|
||||
void setEvicting(bool evicting_, const LockedKey * locked_key, const CachePriorityGuard::Lock * lock) const
|
||||
{
|
||||
if (evicting_ && (!locked_key || !lock))
|
||||
|
@ -10,11 +10,6 @@
|
||||
namespace DB
|
||||
{
|
||||
|
||||
namespace ErrorCodes
|
||||
{
|
||||
extern const int LOGICAL_ERROR;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
size_t getRatio(size_t total, double ratio)
|
||||
|
Loading…
Reference in New Issue
Block a user