Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@rubanm
Copy link
Contributor

@rubanm rubanm commented Nov 3, 2013

Add a batched version of multiPut that splits the kv set into insert, update and delete queries.

@rubanm
Copy link
Contributor Author

rubanm commented Nov 3, 2013

My handling of futures looks a bit clunky. Would appreciate any help with it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

this is not an override. That's a bit weird. It means it can't work with any code that wants a multiPut. That's a shame.

Also, batching is probably something that should be done with a combinator for all stores. See:

https://github.com/twitter/storehaus/blob/develop/storehaus-core/src/main/scala/com/twitter/storehaus/BatchedReadableStore.scala#L30

You want something like that for Store, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense.

I'll move this to a separate batched store version, though, it looks like all the sql logic will need to go to a separate MySqlBatchedStore which extends the generic BatchedStore?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It may extend or users can use the combinator: new BatchedStore(mySqlStore, 1000) or: mySqlStore.batched(1000) or something.

@rubanm
Copy link
Contributor Author

rubanm commented Nov 5, 2013

Decided to go with overriding Store's multiPut so we do not need a separate batched version specific to mysql. (By batching, I originally meant grouping all keys in multiPut to a single sql query.)

I've created a separate pull req for BatchedStore combinator #175

Copy link
Collaborator

Choose a reason for hiding this comment

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

do you want to sequence these futures? Now the order is non-deterministic. Is that what you want?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm thinking this is okay since order is not important here, and all these futures complete as part of object instantiation?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes. I was dreaming of Haskell and lazy everywhere... Ian also corrected me.

Copy link
Collaborator

Choose a reason for hiding this comment

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

lazy val

@rubanm rubanm closed this Nov 7, 2013
@rubanm rubanm deleted the mysql_batch branch November 7, 2013 07:06
@rubanm
Copy link
Contributor Author

rubanm commented Nov 7, 2013

Deleted the branch mistakenly. Re-opening.

@rubanm rubanm reopened this Nov 7, 2013
Copy link
Collaborator

Choose a reason for hiding this comment

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

why not just v => putResult.unit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed the combinator on the earlier mapCollect output to flatMap. Works now.

@johnynek
Copy link
Collaborator

johnynek commented Nov 7, 2013

Thank you!

johnynek added a commit that referenced this pull request Nov 7, 2013
@johnynek johnynek merged commit 3e27f1e into twitter:develop Nov 7, 2013
@rubanm
Copy link
Contributor Author

rubanm commented Nov 8, 2013

Thanks for reviewing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants