Browse Source

distribute .ecx files

add-ec-vacuum
chrislu 5 months ago
parent
commit
56db0a081a
  1. 11
      weed/worker/tasks/ec_vacuum/ec_vacuum_task.go

11
weed/worker/tasks/ec_vacuum/ec_vacuum_task.go

@ -598,8 +598,7 @@ func (t *EcVacuumTask) distributeNewEcShards() error {
targetBaseFileName := filepath.Join(t.tempDir, fmt.Sprintf("%s_%d_g%d", t.collection, t.volumeID, t.targetGeneration)) targetBaseFileName := filepath.Join(t.tempDir, fmt.Sprintf("%s_%d_g%d", t.collection, t.volumeID, t.targetGeneration))
// Step 1: Find best server for shared index files (.vif, .ecj)
// Note: .ecx files are skipped per user guidance - they can be regenerated
// Step 1: Find best server for shared index files (.vif, .ecj, .ecx)
var indexServer pb.ServerAddress var indexServer pb.ServerAddress
for serverAddr := range t.sourceNodes { for serverAddr := range t.sourceNodes {
// Use the first server as index server // Use the first server as index server
@ -609,8 +608,7 @@ func (t *EcVacuumTask) distributeNewEcShards() error {
break break
} }
// Step 2: Distribute index files (.vif, .ecj) to index server only (shared files)
// Note: .ecx files are skipped per user guidance - they can be regenerated
// Step 2: Distribute index files (.vif, .ecj, .ecx) to index server only (shared files)
if indexServer != "" { if indexServer != "" {
err := t.distributeIndexFiles(indexServer, targetBaseFileName) err := t.distributeIndexFiles(indexServer, targetBaseFileName)
if err != nil { if err != nil {
@ -665,17 +663,18 @@ func (t *EcVacuumTask) distributeNewEcShards() error {
return nil return nil
} }
// distributeIndexFiles distributes index files (.vif, .ecj) to a server with dedicated index folder
// distributeIndexFiles distributes index files (.vif, .ecj, .ecx) to a server with dedicated index folder
func (t *EcVacuumTask) distributeIndexFiles(indexServer pb.ServerAddress, targetBaseFileName string) error { func (t *EcVacuumTask) distributeIndexFiles(indexServer pb.ServerAddress, targetBaseFileName string) error {
t.LogInfo("Distributing index files to index server", map[string]interface{}{ t.LogInfo("Distributing index files to index server", map[string]interface{}{
"index_server": indexServer, "index_server": indexServer,
"target_generation": t.targetGeneration, "target_generation": t.targetGeneration,
}) })
// List of index files to distribute (note: .ecx files are skipped)
// List of index files to distribute
indexFiles := []string{ indexFiles := []string{
targetBaseFileName + ".vif", // Volume info file targetBaseFileName + ".vif", // Volume info file
targetBaseFileName + ".ecj", // Empty deletion journal for new generation targetBaseFileName + ".ecj", // Empty deletion journal for new generation
targetBaseFileName + ".ecx", // EC index file - required for mounting
} }
return operation.WithVolumeServerClient(false, indexServer, t.grpcDialOption, func(client volume_server_pb.VolumeServerClient) error { return operation.WithVolumeServerClient(false, indexServer, t.grpcDialOption, func(client volume_server_pb.VolumeServerClient) error {

Loading…
Cancel
Save