Skip to content

Fix restore log entry#2723

Merged
robfrank merged 3 commits intoArcadeData:mainfrom
gramian:main
Nov 2, 2025
Merged

Fix restore log entry#2723
robfrank merged 3 commits intoArcadeData:mainfrom
gramian:main

Conversation

@gramian
Copy link
Collaborator

@gramian gramian commented Oct 30, 2025

What does this PR do?

This change swaps two arguments in the format method of the log entry when a restore is complete. Before the change the log entry is equal to the back-up log entry which writes the uncompressed database compressed to disk. For restore the compressed database is loaded uncompressed to memory, so the entry should state: "from small to large".

Checklist

  • I have run the build using mvn clean package command
  • My unit tests cover both failure and success scenarios

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @gramian, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an issue where the log message for a completed database restore operation was displaying incorrect size information. The change involves swapping two arguments in the log formatting, which ensures the message accurately represents the transition from the smaller, compressed input file size to the larger, uncompressed database size in memory, thus providing a more precise record of the restore process.

Highlights

  • Log Entry Correction: Corrected the order of arguments in the restore completion log entry to accurately reflect the size transition.
  • Accurate Size Representation: Ensures the log entry now correctly displays the size progression from the compressed input file to the uncompressed database in memory.
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
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@mergify
Copy link
Contributor

mergify bot commented Oct 30, 2025

🧪 CI Insights

Here's what we observed from your CI run for 859f696.

🟢 All jobs passed!

But CI Insights is watching 👀

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 correctly fixes a log message for the database restore process by swapping the arguments for the compressed and uncompressed sizes. The log will now correctly show the transition from the smaller backup file size to the larger restored database size. I've added one comment regarding a potential integer overflow in the compression percentage calculation within the same log statement and suggested a safer way to compute it.

Comment on lines +108 to 109
FileUtils.getSizeAsString((inputSource.fileSize)), FileUtils.getSizeAsString(databaseOrigSize),
databaseOrigSize > 0 ? (databaseOrigSize - inputSource.fileSize) * 100 / databaseOrigSize : 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The calculation for compression percentage on the next line can overflow if databaseOrigSize is very large (e.g., in the petabyte range). Using integer arithmetic, (databaseOrigSize - inputSource.fileSize) * 100 could exceed Long.MAX_VALUE before the division occurs.

Using floating-point arithmetic for the calculation makes it safe against overflow and ensures the percentage is calculated correctly even for extremely large database sizes.

I've also removed the redundant parentheses around inputSource.fileSize in the suggestion.

Suggested change
FileUtils.getSizeAsString((inputSource.fileSize)), FileUtils.getSizeAsString(databaseOrigSize),
databaseOrigSize > 0 ? (databaseOrigSize - inputSource.fileSize) * 100 / databaseOrigSize : 0);
FileUtils.getSizeAsString(inputSource.fileSize), FileUtils.getSizeAsString(databaseOrigSize),
databaseOrigSize > 0 ? (long) (100.0 * (databaseOrigSize - inputSource.fileSize) / databaseOrigSize) : 0);

@robfrank robfrank merged commit a1be4b2 into ArcadeData:main Nov 2, 2025
10 of 13 checks passed
@gramian gramian mentioned this pull request Nov 3, 2025
2 tasks
robfrank pushed a commit that referenced this pull request Nov 10, 2025
(cherry picked from commit a1be4b2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants