- 
                Notifications
    
You must be signed in to change notification settings  - Fork 284
 
update cdc retry #22753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Open
      
      
            jiangxinmeng1
  wants to merge
  31
  commits into
  matrixorigin:main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
jiangxinmeng1:update_cdc_retry
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
                
     Open
            
            update cdc retry #22753
      
        
          +2,118
        
        
          −426
        
        
          
        
      
    
  
Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    
              
                    aptend
  
              
              approved these changes
              
                  
                    Nov 4, 2025 
                  
              
              
            
            
              
                    ck89119
  
              
              approved these changes
              
                  
                    Nov 4, 2025 
                  
              
              
            
            
              
                    zhangxu19830126
  
              
              approved these changes
              
                  
                    Nov 4, 2025 
                  
              
              
            
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      Labels
  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.
  
    
  
    
User description
What type of PR is this?
Which issue(s) this PR fixes:
issue #22718
What this PR does / why we need it:
This PR implements a robust retry mechanism for Change Data Capture (CDC) operations with improved error handling and thread-safety.
Key Changes:
Structured Retry Error Handling
Added ParseRetryableError() and GenerateRetryableError() functions
Implemented error format: retryable error::<retry_count>:<error_message>
Thread-Safe DbTableInfo
Converted public fields to private with mutex protection and getter/setter methods
Added retry tracking fields: retryStartTS, retryTimes
Enhanced Reader/Sinker Components
Updated table reader to track and persist retry attempts with timestamps
Changed watermark updater to interface type for better testability
Fixed concurrent access issues in table scanner by removing global handling flag
Testing and Code Cleanup
Added comprehensive CDC test suite (cdc_test.go, 646 lines)
PR Type
Bug fix, Enhancement, Tests
Description
Implement CDC retry mechanism with transaction rollback on connection errors
ErrConnDoneis encounteredParseRetryableErrorandGenerateRetryableErrorutility functionsRefactor watermark updater to use interface instead of concrete type
CDCWatermarkUpdatertoWatermarkUpdaterinterface across codebaseAdd comprehensive CDC retry test suite with mock components
MockWatermarkUpdaterandMockEngineSinkfor testingImprove retry logic with configurable durations and max retry limits
Diagram Walkthrough
File Walkthrough
5 files
Implement retry tracking with timestamp and countAdd retry configuration constants and fieldsAdd retry error parsing and generation functionsConvert to interface-based design patternRefactor to use WatermarkUpdater interface and add setter methods1 files
Add connection error detection and retry logic5 files
Add comprehensive tests for retry error parsingUpdate test signatures for new retry error formatAdd comprehensive CDC retry scenario testsImplement mock sink and watermark updater for testingUpdate test calls for new retry error return values