Skip to content
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

start() options ignored if server already connected #61

Open
lperrin opened this issue Apr 12, 2017 · 2 comments
Open

start() options ignored if server already connected #61

lperrin opened this issue Apr 12, 2017 · 2 comments

Comments

@lperrin
Copy link

lperrin commented Apr 12, 2017

I tried something like:

const zongji = new ZongJi({
  host: argv['source-host'],
  user: argv['source-user'],
  password: argv['source-password'],
  charset: 'utf8mb4'
});

someAsyncCode(function () {
    zongji.start({
      startAtEnd: true,
      includeEvents: ['tablemap', 'writerows', 'updaterows', 'deleterows', 'rotate'],
      includeSchema: includeSchema
    });
});

I realized that my options (including startAtEnd) were ignored by ZongJi. I suspect it's because the connection is already established by the time I call .start(). It's not a critical problem but it'd be great if it was mentioned in the doc.

Thanks for the great work!

@mrichards42
Copy link
Contributor

I just came across this issue today as well. The binlogOptions set in _init() are not overwritten when start() is called. If start() is called before all of the async initialization takes place, this works fine, but if zongji is created well before start() is called, then generateBinlog() already happened and the filename/startpos cannot change.

It seems like the fix is to move the ready function into start(). I think you should be able to set most if not all of the options that are sent to generateBinlog after construction anyways.

@brainsiq
Copy link

brainsiq commented Aug 1, 2017

Burned by this. Seems best to pass the options as the second parameter to the Zongji constructor, even though the docs say to pass startAtEnd to the start function.

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

No branches or pull requests

3 participants