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

Introduce new streaming RPCs to the admin server. #320

Merged
merged 3 commits into from
Apr 22, 2021
Merged

Conversation

mol123
Copy link
Contributor

@mol123 mol123 commented Apr 21, 2021

The new RPCs are:

  • StreamClientIds
  • StreamClientContacts

The motivation is that both the client and client contacts tables can be very
large.

The new RPCs are:

 - `StreamClientIds`
 - `StreamClientContacts`

The motivation is that both the client and client contacts tables can be very
large.
@@ -51,6 +51,32 @@ func uint64ToBytes(i uint64) []byte {
return b
}

func (d *Datastore) StreamClientIds(ctx context.Context, callback func(common.ClientID) error) error {
return d.runInTx(ctx, true, func(tx *sql.Tx) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runInTx is a retry loop, which could lead to strange behavior (duplicate events, mostly). Maybe streaming reads should just call "runOnce" directly, and recognize that the caller might need to retry?

Also, it might be a time to fix (well, implement) the handling of the readonly flag. At least, recent versions of the golang sql package provide a way to pass it in to BeginTx. I don't know how complete the actual mysql driver support is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done switching to runOnce.

I've created #321 for the readonly flag.

@mol123 mol123 merged commit 110667a into master Apr 22, 2021
@mol123 mol123 deleted the mol123-streaming-db branch April 22, 2021 16:55
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

Successfully merging this pull request may close these issues.

2 participants