merge_and_validate_region_wal_options

Function merge_and_validate_region_wal_options 

Source
pub fn merge_and_validate_region_wal_options(
    region_wal_options: &HashMap<RegionNumber, String>,
    new_region_wal_options: HashMap<RegionNumber, String>,
    new_region_routes: &[RegionRoute],
    table_id: TableId,
) -> Result<HashMap<RegionNumber, String>>
Expand description

Merges and validates region WAL options for repartition.

This function:

  1. Validates that new WAL options don’t overwrite existing ones
  2. Merges existing region_wal_options with new new_region_wal_options
  3. Filters out WAL options for regions that are not in new_region_routes
  4. Validates that every region in new_region_routes has a corresponding WAL option

§Arguments

  • region_wal_options - Existing region WAL options from datanode table
  • new_region_wal_options - New region WAL options to merge (should only contain newly allocated regions)
  • new_region_routes - The new region routes after repartition
  • table_id - Table ID for error reporting

§Returns

Returns the merged and filtered WAL options, ensuring all regions have options.

§Errors

Returns an error if:

  • New WAL options try to overwrite existing ones for the same region
  • Any region in new_region_routes is missing a WAL option