Implement index (fast) scrubbing for regular/EC volumes. (#8207)

Implement index (fast) scrubbing for regular/EC volumes via `ScrubVolume()`/`ScrubEcVolume()`.

Also rearranges existing index test files for reuse across unit tests for different modules.
This commit is contained in:
Lisandro Pin
2026-02-05 20:27:03 +01:00
committed by GitHub
parent 82d9d8687b
commit f84b70c362
13 changed files with 254 additions and 17 deletions

Binary file not shown.

View File

@@ -332,3 +332,14 @@ func SearchNeedleFromSortedIndex(ecxFile *os.File, ecxFileSize int64, needleId t
func (ev *EcVolume) IsTimeToDestroy() bool {
return ev.ExpireAtSec > 0 && time.Now().Unix() > (int64(ev.ExpireAtSec)+destroyDelaySeconds)
}
func (ev *EcVolume) CheckIndex() (int64, []error) {
if ev.ecxFile == nil {
return 0, []error{fmt.Errorf("no ECX file associated with EC volume %v", ev.VolumeId)}
}
if ev.ecxFileSize == 0 {
return 0, []error{fmt.Errorf("zero-size ECX file for EC volume %v", ev.VolumeId)}
}
return idx.CheckIndexFile(ev.ecxFile, ev.ecxFileSize, ev.Version)
}

View File

@@ -13,7 +13,7 @@ import (
func TestPositioning(t *testing.T) {
ecxFile, err := os.OpenFile("389.ecx", os.O_RDONLY, 0)
ecxFile, err := os.OpenFile("../idx/test_files/389.ecx", os.O_RDONLY, 0)
if err != nil {
t.Errorf("failed to open ecx file: %v", err)
}