feat: implement sync progress tracking for Oracle driver #575
+30
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 queryALL_TABLES.NUM_ROWS
from Oracle's data dictionary• Updated
GetOrSplitChunks()
to retrieve table statistics and callAddRecordsToSyncStats()
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
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 logsPattern 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