Skip to content

Evicting on small disks #41

@2a46m4

Description

@2a46m4

Evicting on very small disks will produce an error where the reverse map entry is not found. This shouldn't occur, so I added a panic to find the cause.

panic!("Couldn't find chunk {:?} in {:#?}", chunk, bucket_guard);

This produces a panic below:

thread '<unnamed>' panicked at oxcache/src/cache/mod.rs:383:21:
Couldn't find chunk ChunkLocation { zone: 1, index: 1 } in BucketMap

Reproduction

Disk values:

sector_size=4096
zone_size=128
zone_capacity=0
disk_size=1 # Gigabyte
max_open=3
max_active=3
zasl=5
img=""
hostdir=""
cores=$(nproc)

My config file.

log_level = "debug"

[server]
socket = "/tmp/oxcache.sock"
disk = "/dev/nvme0n1"
writer_threads = 3
reader_threads = 3
chunk_size = 67108864 # 64MB
block_zone_capacity = 1129316352
max_write_size = 131072

[remote]
remote_type = "emulated" # emulated | S3
bucket = "S3_BUCKET"
remote_artificial_delay_microsec = 40632

[eviction]
eviction_policy = "chunk"
# These numbers are in chunks
high_water_evict = 10 # Number remaining from end, evicts if reaches here
low_water_evict = 15  # Evict until below mark
high_water_clean = 4 # Number of invalids when we begin cleaning
low_water_clean = 2  # Clean until below mark (only used with chunk)
eviction_interval = 1  # Evict every 1s

[metrics]

I run the ./rsync_and_compile.sh script to produce the error.

Potential cause

We update the eviction LRU before updating the map, there is a chance (given an appropriate eviction threshold) that the LRU will pick it as a eviction target before the map is updated. Then the reverse mapping will return None instead of Some.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions