Skip to content

feat: auto vacuum after gc#823

Merged
looplj merged 2 commits into
unstablefrom
development
Feb 11, 2026
Merged

feat: auto vacuum after gc#823
looplj merged 2 commits into
unstablefrom
development

Conversation

@looplj

@looplj looplj commented Feb 10, 2026

Copy link
Copy Markdown
Owner

No description provided.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @looplj, 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 enhances the garbage collection process by integrating optional database VACUUM operations. This feature aims to automatically reclaim disk space and optimize database performance after data cleanup, particularly for SQLite and PostgreSQL, with configurable options for the type of VACUUM performed.

Highlights

  • New Configuration Options: Introduced new configuration options gc.vacuum_enabled and gc.vacuum_full to control automatic database VACUUM operations.
  • Automatic VACUUM Execution: Implemented automatic execution of the VACUUM command after garbage collection for SQLite and PostgreSQL databases.
  • PostgreSQL VACUUM FULL Support: Added support for VACUUM FULL in PostgreSQL, allowing for more aggressive space reclamation when enabled.
Changelog
  • conf/conf.go
    • Added default configuration values for gc.vacuum_enabled and gc.vacuum_full.
  • config.example.yml
    • Included example configuration and detailed comments for gc.vacuum_enabled and gc.vacuum_full, explaining their purpose and database support.
  • internal/server/gc/gc.go
    • Imported necessary ent dialect packages.
    • Extended the Config struct with VacuumEnabled and VacuumFull boolean fields.
    • Modified the runCleanup function to conditionally invoke runVacuum if enabled.
    • Implemented a new runVacuum function to execute database-specific VACUUM commands for SQLite and PostgreSQL, handling VACUUM FULL for PostgreSQL.
    • Added RunVacuumNow as a public method to manually trigger the vacuum process.
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.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

The pull request introduces automatic VACUUM operations after garbage collection, which is a valuable addition for maintaining database performance and reclaiming storage space. The configuration options for enabling VACUUM and specifying VACUUM FULL for PostgreSQL are well-integrated. The implementation correctly identifies the database dialect and applies the appropriate VACUUM command. There are a couple of minor improvements related to documentation clarity and logging verbosity that would enhance maintainability.

Comment thread internal/server/gc/gc.go Outdated
Comment thread internal/server/gc/gc.go
// Try to cast to *entsql.Driver to access underlying *sql.DB
sqlDriver, ok := dbDriver.(*entsql.Driver)
if !ok {
log.Debug(ctx, "Database driver is not *entsql.Driver, skipping VACUUM")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

When the database driver is not *entsql.Driver, it would be more helpful for debugging to log the actual type of dbDriver instead of just skipping. This provides more context if an unexpected driver type is encountered.

Suggested change
log.Debug(ctx, "Database driver is not *entsql.Driver, skipping VACUUM")
log.Debug(ctx, "Database driver is not *entsql.Driver, skipping VACUUM", log.Any("driver_type", fmt.Sprintf("%T", dbDriver)))

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@looplj looplj merged commit adbb04c into unstable Feb 11, 2026
2 checks passed
looplj added a commit that referenced this pull request Mar 1, 2026
* feat: auto vacuum after gc

* Update internal/server/gc/gc.go

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
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.

1 participant