Add Option A: Quick Retry Menu when dump fails

Implements user request for "end of time menu" that lets them quickly
retry dump with different recovery modes without going back to main menu.

NEW FEATURE: show_quick_retry_menu()
- Shows clean, simple menu when dump fails
- Options [1-6] for specific recovery modes
- [A] for auto-escalate
- [0] to return to menu
- Optionally access full troubleshooting if needed

FLOW WHEN DUMP FAILS:
1. Show quick retry menu
2. User picks recovery mode [1-6] or [A]
3. Script retries dump immediately with that mode
4. If user selects [0], ask if they want full troubleshooting
5. If yes, show comprehensive recovery options
6. If no, return to main menu

This gives users fast feedback loop to try different modes
without the lengthy troubleshooting text every time.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
cschantz
2026-02-27 21:06:39 -05:00
parent 0e18252b8d
commit 3c676f7228
+54 -4
View File
@@ -1556,6 +1556,46 @@ show_recovery_options() {
esac esac
} }
# Quick Retry Menu - shown when dump fails to let user pick recovery mode
# Returns 0 if user selects recovery mode, 1 if user wants to exit to menu
show_quick_retry_menu() {
echo ""
echo "════════════════════════════════════════════════════════════════"
echo "Dump failed. Which recovery mode would you like to try?"
echo "════════════════════════════════════════════════════════════════"
echo ""
echo " [1] Recovery mode 1 (ignore corrupt pages)"
echo " [2] Recovery mode 2 (prevent background operations)"
echo " [3] Recovery mode 3 (prevent transaction rollbacks)"
echo " [4] Recovery mode 4 (prevent insert buffer merge)"
echo " [5] Recovery mode 5 (skip redo log)"
echo " [6] Recovery mode 6 (skip page checksums - most aggressive)"
echo " [A] Auto-escalate to next mode"
echo " [0] Return to main menu"
echo ""
echo -n "Select: "
read -r recovery_choice
case "$recovery_choice" in
0)
return 1
;;
[1-6])
FORCE_RECOVERY="$recovery_choice"
print_warning "Will retry with recovery mode $FORCE_RECOVERY"
return 0
;;
A|a)
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) # Check available disk space (CRITICAL SAFETY CHECK #3)
check_disk_space() { check_disk_space() {
local target_dir="$1" local target_dir="$1"
@@ -2612,17 +2652,27 @@ step5_create_dump() {
print_error "Failed to start second MySQL instance" print_error "Failed to start second MySQL instance"
echo "" echo ""
# Provide intelligent recovery guidance (pass selected database name) # Show quick retry menu first - lets user pick recovery mode directly
# show_recovery_options now prompts user and returns:
# - 0 = user wants to retry (FORCE_RECOVERY updated by function) # - 0 = user wants to retry (FORCE_RECOVERY updated by function)
# - 1 = user wants to return to menu # - 1 = user wants to return to menu
if show_recovery_options "$TEMP_DATADIR" "$FORCE_RECOVERY" "$DATABASE_NAME"; then if show_quick_retry_menu; then
# User chose to retry with specific mode - return 2 to signal "retry immediately" # User chose to retry with specific mode - return 2 to signal "retry immediately"
# (bypass auto-escalation in menu loop) # (bypass auto-escalation in menu loop)
echo "" echo ""
return 2 return 2
else else
# User chose to return to menu - return 1 (failure) # User wants to return to menu or see full troubleshooting
# Ask if they want to see full recovery options
echo ""
echo -n "Would you like to see full troubleshooting options? (y/n): "
read -r show_full
if [ "$show_full" = "y" ]; then
echo ""
if show_recovery_options "$TEMP_DATADIR" "$FORCE_RECOVERY" "$DATABASE_NAME"; then
echo ""
return 2
fi
fi
echo "" echo ""
return 1 return 1
fi fi