Skip to content

Comments

update-pg-walstream-0.4.0#63

Merged
isdaniel merged 2 commits intomainfrom
chore/update-pg-walstream-0.4.0
Feb 20, 2026
Merged

update-pg-walstream-0.4.0#63
isdaniel merged 2 commits intomainfrom
chore/update-pg-walstream-0.4.0

Conversation

@isdaniel
Copy link
Owner

  • Updated tests in sqlite_comprehensive_tests.rs to replace HashMap with RowData for handling event data.
  • Refactored event creation in tests to utilize RowData's from_pairs method for better clarity and consistency.
  • Adjusted assertions and data handling to accommodate the new RowData structure.
  • Similar updates made in sqlite_destination_tests.rs and where_clause_fix_tests.rs to ensure uniformity across test files.
  • Enhanced readability and maintainability of the test code by reducing boilerplate and improving data structure usage.

- Updated tests in `sqlite_comprehensive_tests.rs` to replace HashMap with RowData for handling event data.
- Refactored event creation in tests to utilize RowData's from_pairs method for better clarity and consistency.
- Adjusted assertions and data handling to accommodate the new RowData structure.
- Similar updates made in `sqlite_destination_tests.rs` and `where_clause_fix_tests.rs` to ensure uniformity across test files.
- Enhanced readability and maintainability of the test code by reducing boilerplate and improving data structure usage.
@gemini-code-assist
Copy link

Summary of Changes

Hello @isdaniel, 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 primarily focuses on upgrading the pg_walstream dependency to version 0.4.0 and refactoring internal data structures to align with its new RowData type. This change streamlines how change event data is handled throughout the pg2any-lib, moving from generic HashMaps to a more specialized and efficient RowData structure. The update also includes minor dependency bumps and adjustments to LSN tracking and metrics collection, enhancing overall consistency and maintainability.

Highlights

  • Dependency Updates: The pg_walstream crate has been updated to version 0.4.0, and the tiberius crate to 0.12.3, along with several other minor dependency bumps in Cargo.lock.
  • Data Structure Refactoring: Internal data handling for change events has been refactored to consistently use pg_walstream::RowData instead of HashMap<String, serde_json::Value>, improving type safety and efficiency.
  • SQL Generation Logic Adaptation: SQL generation methods within TransactionManager have been updated to leverage the new RowData structure and Arc<str> for key columns, streamlining data access and reducing conversions.
  • LSN Tracking and Metrics Enhancement: LSN (Log Sequence Number) tracking now uses update_applied_lsn, and metrics collection logic has been adjusted to correctly process table names from the updated EventType structure.
  • Comprehensive Test Suite Alignment: Numerous test files have been updated to reflect the RowData changes, ensuring consistency in event creation, data handling, and assertions across the test suite.

🧠 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
  • .cargo/audit.toml
    • Removed 'RUSTSEC-2026-0001' from the list of ignored advisories.
  • Cargo.lock
    • Updated 'bytes' from 1.11.0 to 1.11.1
    • Updated 'chrono' from 0.4.42 to 0.4.43
    • Updated 'num-conv' from 0.1.0 to 0.2.0
    • Updated 'thiserror' from 2.0.17 to 2.0.18
    • Updated 'pg_walstream' from 0.3.0 to 0.4.0
    • Updated 'rkyv' from 0.7.45 to 0.7.46
    • Updated 'rkyv_derive' from 0.7.45 to 0.7.46
    • Updated 'rsa' from 0.9.9 to 0.9.10
    • Updated 'time' from 0.3.44 to 0.3.47
    • Updated 'time-core' from 0.1.6 to 0.1.8
  • Cargo.toml
    • Updated 'pg_walstream' dependency from 0.3.0 to 0.4.0
    • Updated 'tiberius' dependency from 0.12 to 0.12.3
  • pg2any-lib/src/config.rs
    • Adapted ReplicationStreamConfig creation to use the new StreamingMode enum from pg_walstream.
  • pg2any-lib/src/monitoring/metrics_abstraction.rs
    • Modified table name extraction logic for metrics to correctly handle Arc<str> from EventType.
  • pg2any-lib/src/pg_replication.rs
    • Replaced update_lsn with update_applied_lsn for LSN state management.
  • pg2any-lib/src/transaction_manager.rs
    • Imported RowData from pg_walstream.
    • Refactored generate_insert_sql to accept &RowData directly and convert to HashMap internally for iteration.
    • Updated generate_update_sql to accept &RowData and Option<&RowData> for new and old data, and &[Arc<str>] for key columns.
    • Adjusted generate_delete_sql to accept &RowData for old data and &[Arc<str>] for key columns.
    • Modified generate_truncate_sql to accept &[Arc<str>] for table names.
    • Refactored build_where_clause to use RowData and Arc<str> for efficient key column lookups without HashMap conversions for common cases.
  • pg2any-lib/src/types.rs
    • Re-exported RowData from pg_walstream for broader internal use.
  • pg2any-lib/tests/destination_integration_tests.rs
    • Imported RowData and Arc.
    • Updated event creation helper functions (create_test_event, create_update_event, create_delete_event, create_update_event_without_old_data) to use RowData::from_pairs and Arc::from for key columns.
    • Adjusted assertions to use RowData::get instead of HashMap::contains_key.
  • pg2any-lib/tests/event_type_refactor_tests.rs
    • Imported RowData and Arc.
    • Migrated test event creation from HashMap to RowData::from_pairs.
    • Adjusted assertions for schema, table, and key columns to work with Arc<str>.
  • pg2any-lib/tests/integration_tests.rs
    • Updated column name assertion to use as_ref() for Arc<str>.
  • pg2any-lib/tests/metrics_logical_tests.rs
    • Imported RowData and Arc.
    • Changed test event creation helper functions to use RowData::from_pairs and Arc::from for key columns.
  • pg2any-lib/tests/mysql_edge_cases_tests.rs
    • Imported RowData and Arc.
    • Converted test data to RowData::from_pairs and key columns to Arc::from.
    • Adjusted assertions to use RowData::get.
  • pg2any-lib/tests/mysql_error_handling_simple_tests.rs
    • Imported RowData and Arc.
    • Refactored test data and key column types to RowData::from_pairs and Arc::from.
    • Adjusted assertions for key column presence and schema/table names.
  • pg2any-lib/tests/mysql_where_clause_fix_tests.rs
    • Imported RowData and Arc.
    • Updated test data and key column handling to use RowData::from_pairs and Arc::from.
    • Adjusted assertions to use RowData::get.
  • pg2any-lib/tests/replica_identity_tests.rs
    • Imported RowData and Arc.
    • Modified test event creation and assertions to use RowData::from_pairs and Arc::from for key columns.
    • Updated get_old_data helper to return Option<RowData>.
  • pg2any-lib/tests/sqlite_comprehensive_tests.rs
    • Imported RowData and Arc.
    • Adapted event_to_sql helper to handle RowData for data and Arc<str> for key columns.
    • Refactored all test cases to create event data using RowData::from_pairs and key columns with Arc::from.
  • pg2any-lib/tests/sqlite_destination_tests.rs
    • Imported RowData and Arc.
    • Refactored event_to_sql helper to handle RowData and Arc<str> for data and key columns.
    • Updated create_test_data and create_updated_test_data to return RowData.
    • Modified test event creation to use RowData::from_pairs and Arc::from for key columns.
  • pg2any-lib/tests/where_clause_fix_tests.rs
    • Imported RowData and Arc.
    • Updated test event data and key column types to RowData::from_pairs and Arc::from.
    • Adjusted assertions to use RowData::get and handle RowData to HashMap conversion for iteration.
Activity
  • No human activity has been recorded on this pull request yet.
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.

Copy link

@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

The pull request successfully updates pg_walstream to version 0.4.0 and refactors the event data handling to use the more efficient RowData structure instead of HashMap. This change significantly reduces boilerplate in tests and improves data handling consistency across the library. I have provided some feedback regarding redundant type bindings and opportunities for minor performance optimizations in the SQL generation and metrics collection paths.

@isdaniel
Copy link
Owner Author

/gemini review

Copy link

@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 updates the pg_walstream dependency to version 0.4.0 and refactors the codebase to adapt to the API changes, primarily replacing HashMap with RowData for handling event data. While the changes are extensive and well-executed, improving code clarity and performance, the SQL generation logic remains vulnerable to SQL injection via unescaped identifiers and improper string literal escaping for MySQL. These security issues must be addressed to ensure the security of the data synchronization process, especially when syncing between different security domains.

@isdaniel isdaniel merged commit 28d6aa2 into main Feb 20, 2026
17 checks passed
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