(execCtx *common.ExecContext, cfg *common.MySQLDriverConfig, logger g.LoggerType, storeManager *common.StoreManager, waitCh chan *drivers.ExitResult, ctx context.Context)
| 111 | } |
| 112 | |
| 113 | func NewExtractor(execCtx *common.ExecContext, cfg *common.MySQLDriverConfig, logger g.LoggerType, storeManager *common.StoreManager, waitCh chan *drivers.ExitResult, ctx context.Context) (*Extractor, error) { |
| 114 | logger.Info("NewExtractor", "job", execCtx.Subject) |
| 115 | |
| 116 | e := &Extractor{ |
| 117 | ctx: ctx, |
| 118 | logger: logger.Named("extractor").With("job", execCtx.Subject), |
| 119 | execCtx: execCtx, |
| 120 | subject: execCtx.Subject, |
| 121 | mysqlContext: cfg, |
| 122 | rowCopyComplete: make(chan bool), |
| 123 | waitCh: waitCh, |
| 124 | shutdownCh: make(chan struct{}), |
| 125 | testStub1Delay: 0, |
| 126 | sqleContext: sqle.NewContext(nil), |
| 127 | gotCoordinateCh: make(chan struct{}), |
| 128 | streamerReadyCh: make(chan error), |
| 129 | fullCopyDone: make(chan struct{}), |
| 130 | storeManager: storeManager, |
| 131 | memory1: new(int64), |
| 132 | memory2: new(int64), |
| 133 | replicateDoDb: map[string]*common.SchemaContext{}, |
| 134 | } |
| 135 | e.dataChannel = make(chan *common.EntryContext, cfg.ReplChanBufferSize*4) |
| 136 | e.timestampCtx = NewTimestampContext(e.shutdownCh, e.logger, func() bool { |
| 137 | return len(e.dataChannel) == 0 |
| 138 | // TODO need a more reliable method to determine queue.empty. |
| 139 | }) |
| 140 | |
| 141 | e.sqleContext.LoadSchemas(nil) |
| 142 | logger.Debug("NewExtractor. after LoadSchemas") |
| 143 | if delay, err := strconv.ParseInt(os.Getenv(g.ENV_TESTSTUB1_DELAY), 10, 64); err == nil { |
| 144 | e.logger.Info("env", g.ENV_TESTSTUB1_DELAY, delay) |
| 145 | e.testStub1Delay = delay |
| 146 | } |
| 147 | |
| 148 | return e, nil |
| 149 | } |
| 150 | |
| 151 | // Run executes the complete extract logic. |
| 152 | func (e *Extractor) Run() { |
no test coverage detected