find master address earlier

This commit is contained in:
chrislu
2025-08-13 01:52:03 -07:00
parent e44a6189fa
commit 52f26187ca
2 changed files with 21 additions and 4 deletions

View File

@@ -135,6 +135,25 @@ func (t *EcVacuumTask) Execute(ctx context.Context, params *worker_pb.TaskParams
t.LogInfo("Starting EC vacuum task with runtime generation detection", logFields)
// Step 0.5: Get master address early for generation activation
if t.masterAddress == "" {
if err := t.fetchMasterAddressFromAdmin(); err != nil {
t.LogWarning("Failed to get master address - generation activation will be manual", map[string]interface{}{
"error": err.Error(),
"volume_id": t.volumeID,
"target_generation": t.targetGeneration,
"note": "Task will continue but activation must be done manually",
})
// Continue execution - this is not fatal, just means manual activation required
} else {
t.LogInfo("Master address obtained for automatic generation activation", map[string]interface{}{
"master_address": t.masterAddress,
"volume_id": t.volumeID,
"target_generation": t.targetGeneration,
})
}
}
// Step 1: Create temporary working directory
if err := t.createTempDir(); err != nil {
return fmt.Errorf("failed to create temp directory: %w", err)

View File

@@ -11,11 +11,9 @@ import (
// performSafetyChecks performs comprehensive safety verification before cleanup
func (t *EcVacuumTask) performSafetyChecks() error {
// Get master address from admin server if not already set
// Master address should have been fetched early in execution
if t.masterAddress == "" {
if err := t.fetchMasterAddressFromAdmin(); err != nil {
return fmt.Errorf("CRITICAL: cannot perform safety checks - failed to get master address: %w", err)
}
return fmt.Errorf("CRITICAL: cannot perform safety checks - master address not available (should have been fetched during task initialization)")
}
// Safety Check 1: Verify master connectivity and volume existence