oxidecomputer / crucible

A storage service.
Mozilla Public License 2.0
175 stars 18 forks source link

crutest's `RegionInfo` needs to support Volume level. #1454

Open leftwo opened 2 months ago

leftwo commented 2 months ago

The current way crutest works for many tests is to build a RegionInfo struct which looks as follows:

pub struct RegionInfo {                                                             
    block_size: u64,                                                                
    extent_size: Block,                                                             
    total_size: u64,                                                                
    total_blocks: usize,                                                            
    write_log: WriteLog,                                                            
    max_block_io: usize,                                                            
}

This allows it to figure out where the extents end and from that how to create tests that catch edge conditions for us without having to first inspect the region then manually create a specific test for it.

In the volume centric world, where we can have multiple SubVolumes, this single structure is no longer contains the information we need, and can't actually represent what we want.

leftwo commented 2 months ago

Perhaps a new struct, replace RegionInfo with VolumeInfo

For a Volume, We could store <Vec<RegionInfo>> for each sub_volume <Option<RegionInfo>> for read_only_parent

With a geust, it would just be: A vec, with just one RegionInfo None for read_only_parent

Something like this that mimics the way we do volumes:

struct VolumeInfo {
    // Block size for the volume,
    block_size: u64,
    // Total blocks in the volume
    total_blocks: u64,
    // SubVolumes that make up this volume.
    sub_volume: Vec<SubVolumeInfo>
    read_only_parent: Option<SubVolumeInfo>
    // write log for the volume
    write_log: WriteLog,
} 

With

struct SubVolumeInfo{
    // Number blocks per extent
    extent_size: Block,
    // Total extents in this sub volume
    extent_count: u64,
    // Total size in bytes for this sub volume
    total_size: u64,
    // Range this sub volume covers.
    range: Range,
}

I'm not even sure if we need to (at first) support read only parents in crutest, but we can if we want.