Skip to content

Conversation

siiddhantt
Copy link

@siiddhantt siiddhantt commented Oct 9, 2025

Description

This PR implements sync progress tracking for the Oracle driver, enabling users to see estimated time of completion (ETC) and sync progress statistics, bringing it to feature parity with MySQL, Postgres, and MongoDB drivers.

Changes:

• Added OracleTableRowStatsQuery() function to query ALL_TABLES.NUM_ROWS from Oracle's data dictionary
• Updated GetOrSplitChunks() to retrieve table statistics and call AddRecordsToSyncStats() before chunking
• Added validation to check if statistics are available (NUM_ROWS is not NULL or 0)
• Implemented helpful error messages instructing users to run DBMS_STATS.GATHER_TABLE_STATS if statistics are missing
• Added graceful handling of empty tables with warning messages
• Maintained consistent error handling patterns with other drivers

Fixes #400

Type of change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Code Verification:

• Build successful - Oracle driver compiles without errors
• Implementation matches MySQL and Postgres driver patterns
• Query uses Oracle's standard ALL_TABLES data dictionary view with proper bind variable syntax (:1, :2)
• Logic verified: AddRecordsToSyncStats() integrates with existing progress tracking system that displays "Estimated Remaining Time" in logs

Pattern Consistency:

• Oracle implementation now matches MySQL's MySQLTableRowStatsQuery() pattern
• Uses sql.NullInt64 for proper NULL handling (Oracle statistics can be NULL if never gathered)
• Error messages follow same format as MySQL: "stats not populated for table[X]. Please run DBMS_STATS.GATHER_TABLE_STATS..."
• Empty table handling consistent across all drivers

Expected Behavior:

✅ With statistics gathered: Progress tracking works, ETC displayed
✅ Without statistics: Error message with DBMS_STATS instructions
✅ Empty tables: Warning logged, sync continues gracefully

@vaibhav-datazip
Copy link
Collaborator

@siiddhantt
you need to set staging branch as the base

@vaibhav-datazip vaibhav-datazip added the hacktoberfest Issues open for Hacktoberfest contributors label Oct 10, 2025
@siiddhantt siiddhantt force-pushed the feat/sync-progress-oracle branch from 64df1c4 to babe1e7 Compare October 10, 2025 19:52
@siiddhantt
Copy link
Author

@vaibhav-datazip thanks for the review.
I've made the changes and tested it out using the Oracle XE Docker, with rows synced successfully and progress tracking confirmed working via stats file.

@siiddhantt siiddhantt changed the base branch from master to staging October 10, 2025 20:03
@vaibhav-datazip
Copy link
Collaborator

vaibhav-datazip commented Oct 11, 2025

@siiddhantt , the commit history isn't clean as there was some merge in master and later this was rebased to staging. can you resolve this issue, so that only your commits appear in this PR

- Add OracleTableRowStatsQuery() to query ALL_TABLES.NUM_ROWS and AVG_ROW_LEN
- Update GetOrSplitChunks() to call AddRecordsToSyncStats() with row count
- Add statistics validation with helpful error messages for missing stats
- Handle empty tables gracefully with appropriate warnings
- Consistent implementation with MySQL, Postgres, and MongoDB drivers
@siiddhantt siiddhantt force-pushed the feat/sync-progress-oracle branch from d76f49d to 560352f Compare October 11, 2025 10:07
@siiddhantt
Copy link
Author

@vaibhav-datazip done, cleaned out the commit history!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest Issues open for Hacktoberfest contributors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add implementation of AddRecordsToSync function in Oracle to estimate remaining sync time

2 participants