MAJOR UX IMPROVEMENT: Replace 'Press Enter' with action menu
When InnoDB recovery fails, instead of just asking 'Press Enter', now shows clear action menu: [0] Return to menu [1] Retry with recovery mode 1 [2] Retry with recovery mode 2 ... (modes 3-6) [A] Auto-escalate to next mode User can immediately select action without confusing prompts. If user selects specific mode, retries immediately with that mode (skips auto-escalation). Implementation: - show_recovery_options() now prompts for action - Returns 0 = retry with selected mode - Returns 1 = return to menu - step5_create_dump handles return codes: - 0 = success - 1 = failure, return to menu - 2 = failure, user selected mode, retry immediately - Menu loop checks return code 2 and continues without auto-escalation Benefits: ✓ Clear options - user knows what will happen ✓ No confusing 'Press Enter to continue' prompts ✓ Immediate retry with user-selected mode ✓ Better control over recovery process ✓ Fixes the 'type 4' confusion from previous run Severity: UX Improvement Impact: Much better user experience during recovery Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1516,9 +1516,43 @@ show_recovery_options() {
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# CRITICAL: Always return 0 to indicate function completed successfully
|
||||
# Caller (step5_create_dump) will handle the failure and return 1
|
||||
# Prompt user for action (don't just "Press Enter")
|
||||
echo ""
|
||||
print_info "What would you like to do?"
|
||||
echo ""
|
||||
echo " [0] Return to menu (stop recovery attempt)"
|
||||
echo " [1] Retry with recovery mode 1 (ignore corrupt pages)"
|
||||
echo " [2] Retry with recovery mode 2 (prevent background ops)"
|
||||
echo " [3] Retry with recovery mode 3 (prevent rollbacks)"
|
||||
echo " [4] Retry with recovery mode 4 (prevent insert buffer merge)"
|
||||
echo " [5] Retry with recovery mode 5 (skip redo log)"
|
||||
echo " [6] Retry with recovery mode 6 (skip page checksums)"
|
||||
echo " [A] Auto-escalate (let script choose next mode)"
|
||||
echo ""
|
||||
echo -n "Select: "
|
||||
read -r recovery_choice
|
||||
|
||||
case "$recovery_choice" in
|
||||
0)
|
||||
# Return to menu
|
||||
return 1
|
||||
;;
|
||||
[1-6])
|
||||
# User selected specific recovery mode
|
||||
FORCE_RECOVERY="$recovery_choice"
|
||||
print_warning "Will retry with recovery mode $FORCE_RECOVERY"
|
||||
return 0
|
||||
;;
|
||||
A|a)
|
||||
# Auto-escalate
|
||||
print_warning "Will auto-escalate to next recovery mode"
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
print_error "Invalid selection. Returning to menu."
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Check available disk space (CRITICAL SAFETY CHECK #3)
|
||||
@@ -2577,11 +2611,20 @@ step5_create_dump() {
|
||||
echo ""
|
||||
|
||||
# Provide intelligent recovery guidance (pass selected database name)
|
||||
show_recovery_options "$TEMP_DATADIR" "$FORCE_RECOVERY" "$DATABASE_NAME"
|
||||
|
||||
press_enter
|
||||
# show_recovery_options now prompts user and returns:
|
||||
# - 0 = user wants to retry (FORCE_RECOVERY updated by function)
|
||||
# - 1 = user wants to return to menu
|
||||
if show_recovery_options "$TEMP_DATADIR" "$FORCE_RECOVERY" "$DATABASE_NAME"; then
|
||||
# User chose to retry with specific mode - return 2 to signal "retry immediately"
|
||||
# (bypass auto-escalation in menu loop)
|
||||
echo ""
|
||||
return 2
|
||||
else
|
||||
# User chose to return to menu - return 1 (failure)
|
||||
echo ""
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
@@ -2975,12 +3018,24 @@ main() {
|
||||
# Track the attempt
|
||||
track_recovery_attempt "$FORCE_RECOVERY"
|
||||
|
||||
if step5_create_dump; then
|
||||
step5_create_dump
|
||||
local dump_result=$?
|
||||
|
||||
if [ "$dump_result" -eq 0 ]; then
|
||||
# Success - exit step 5 loop
|
||||
break
|
||||
elif [ "$dump_result" -eq 2 ]; then
|
||||
# User chose specific recovery mode - continue loop to retry immediately
|
||||
# (skip auto-escalation logic)
|
||||
echo ""
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
print_info "Retrying with user-selected recovery mode $FORCE_RECOVERY..."
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
continue
|
||||
fi
|
||||
|
||||
# Dump failed - check if auto-escalation should happen
|
||||
# Dump failed (return code 1) - check if auto-escalation should happen
|
||||
print_warning "Dump creation failed"
|
||||
echo ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user