Skip to content

[FCM] Narrower database open recovery logic#15678

Merged
paulb777 merged 4 commits intomainfrom
pb-fcm-recovery2
Jan 7, 2026
Merged

[FCM] Narrower database open recovery logic#15678
paulb777 merged 4 commits intomainfrom
pb-fcm-recovery2

Conversation

@paulb777
Copy link
Member

@paulb777 paulb777 commented Jan 7, 2026

Follow up to #15553. Only do new recovery logic for SQLITE_CANTOPEN error instead of any open failure.

Gemini's summary:
This pull request refines the database opening and recovery logic within Firebase Messaging to ensure that the destructive recovery action (deleting and recreating the database) is only performed for specific, actionable errors. By narrowing the scope of this recovery to "SQLITE_CANTOPEN" errors, the change aims to improve the robustness and reliability of the database handling, avoiding unintended data loss or operational issues when other, non-corruption related open failures occur.

Highlights

  • Database Recovery Logic Refinement: The database recovery mechanism in Firebase Cloud Messaging (FCM) has been updated to be more specific. Previously, the system would attempt to delete and recreate the database for any SQLite open failure. Now, this recovery process is exclusively triggered when the "SQLITE_CANTOPEN" error is encountered, preventing unnecessary database deletions for other types of open errors.

@gemini-code-assist
Copy link
Contributor

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

@paulb777
Copy link
Member Author

paulb777 commented Jan 7, 2026

/gemini review

@danger-firebase-ios
Copy link

1 Warning
⚠️ Did you forget to add a changelog entry? (Add #no-changelog to the PR description to silence this warning.)

Generated by 🚫 Danger

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refines the database open recovery logic by only attempting to recover from an SQLITE_CANTOPEN error, instead of any database open failure. This makes the error handling more specific and robust. The changes look good. I've added a couple of minor suggestions to improve the wording in logs and comments to reflect that the recovery is not always due to database corruption.

@paulb777 paulb777 added this to the 12.8.0 - M175 milestone Jan 7, 2026
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@paulb777
Copy link
Member Author

paulb777 commented Jan 7, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request narrows the database open recovery logic to only trigger for SQLITE_CANTOPEN errors, which is a good improvement to avoid unnecessarily deleting the database for other types of open failures. The changes look correct and align with the goal. I've added a couple of minor suggestions to improve code formatting for consistency and readability.

paulb777 and others added 2 commits January 6, 2026 16:07
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@paulb777
Copy link
Member Author

paulb777 commented Jan 7, 2026

/gemini summarize

@gemini-code-assist
Copy link
Contributor

Summary of Changes

This pull request refines the database opening and recovery logic within Firebase Messaging to ensure that the destructive recovery action (deleting and recreating the database) is only performed for specific, actionable errors. By narrowing the scope of this recovery to "SQLITE_CANTOPEN" errors, the change aims to improve the robustness and reliability of the database handling, avoiding unintended data loss or operational issues when other, non-corruption related open failures occur.

Highlights

  • Database Recovery Logic Refinement: The database recovery mechanism in Firebase Cloud Messaging (FCM) has been updated to be more specific. Previously, the system would attempt to delete and recreate the database for any SQLite open failure. Now, this recovery process is exclusively triggered when the "SQLITE_CANTOPEN" error is encountered, preventing unnecessary database deletions for other types of open errors.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • FirebaseMessaging/Sources/FIRMessagingRmqManager.m
    • Modified the database open recovery logic to only trigger for "SQLITE_CANTOPEN" errors.
    • Updated log messages to reflect the more specific recovery condition and to clarify when a database is not deleted.
Activity
  • The author, paulb777, requested a review from Gemini Code Assist.
  • A warning was issued by "danger-firebase-ios[bot]" regarding a missing changelog entry.
  • Gemini Code Assist provided several low-priority suggestions, including: clarifying log messages by replacing 'corrupt' with more generic terms like 'database for recovery' or 'open failure', and reformatting "stringWithFormat:" calls for improved readability.

@paulb777 paulb777 requested a review from leojaygoogle January 7, 2026 00:17
@paulb777
Copy link
Member Author

paulb777 commented Jan 7, 2026

Quickstart CI failure is unrelated. Merging.

@paulb777 paulb777 merged commit 546d1bd into main Jan 7, 2026
60 of 61 checks passed
@paulb777 paulb777 deleted the pb-fcm-recovery2 branch January 7, 2026 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants