mirror of
https://github.com/mulgadc/spinifex.git
synced 2026-10-15 17:11:30 +00:00
fix: dispatch chunk WAL opening for EFI and cloud-init volumes
With UseShardedWAL now defaulting to true, the EFI and cloud-init volume preparation must open sharded WAL files instead of always opening the legacy WAL. Without this, Flush() dispatches to the sharded path but shard DB files are nil, causing zero-byte writes.
This commit is contained in:
@@ -391,8 +391,12 @@ func (s *InstanceServiceImpl) prepareEFIVolume(imageId string, volumeConfig vipe
|
||||
if err != nil {
|
||||
slog.Info("Volume does not yet exist, creating EFI disk ...")
|
||||
|
||||
// Open the chunk WAL
|
||||
err = efiVb.OpenWAL(&efiVb.WAL, fmt.Sprintf("%s/%s", efiVb.WAL.BaseDir, types.GetFilePath(types.FileTypeWALChunk, efiVb.WAL.WallNum.Load(), efiVb.GetVolume())))
|
||||
// Open the chunk WAL (sharded or legacy)
|
||||
if efiVb.UseShardedWAL {
|
||||
err = efiVb.OpenShardedWAL()
|
||||
} else {
|
||||
err = efiVb.OpenWAL(&efiVb.WAL, fmt.Sprintf("%s/%s", efiVb.WAL.BaseDir, types.GetFilePath(types.FileTypeWALChunk, efiVb.WAL.WallNum.Load(), efiVb.GetVolume())))
|
||||
}
|
||||
if err != nil {
|
||||
slog.Error("Failed to load WAL", "err", err)
|
||||
return errors.New(awserrors.ErrorServerInternal)
|
||||
@@ -471,8 +475,12 @@ func (s *InstanceServiceImpl) prepareCloudInitVolume(input *ec2.RunInstancesInpu
|
||||
if err != nil {
|
||||
slog.Info("Volume does not yet exist, creating cloud-init disk ...")
|
||||
|
||||
// Open WALs
|
||||
err = cloudInitVb.OpenWAL(&cloudInitVb.WAL, fmt.Sprintf("%s/%s", cloudInitVb.WAL.BaseDir, types.GetFilePath(types.FileTypeWALChunk, cloudInitVb.WAL.WallNum.Load(), cloudInitVb.GetVolume())))
|
||||
// Open the chunk WAL (sharded or legacy)
|
||||
if cloudInitVb.UseShardedWAL {
|
||||
err = cloudInitVb.OpenShardedWAL()
|
||||
} else {
|
||||
err = cloudInitVb.OpenWAL(&cloudInitVb.WAL, fmt.Sprintf("%s/%s", cloudInitVb.WAL.BaseDir, types.GetFilePath(types.FileTypeWALChunk, cloudInitVb.WAL.WallNum.Load(), cloudInitVb.GetVolume())))
|
||||
}
|
||||
if err != nil {
|
||||
slog.Error("Failed to load WAL", "err", err)
|
||||
return errors.New(awserrors.ErrorServerInternal)
|
||||
|
||||
Reference in New Issue
Block a user