jeremydaly / data-api-client

A "DocumentClient" for the Amazon Aurora Serverless Data API
MIT License
446 stars 63 forks source link

data-api-client and shared sessions in terms of row locks #21

Closed misner closed 5 years ago

misner commented 5 years ago

Hello,

I'm wondering something: if I let the default keepAlive=true, does that mean all lambdas (concurrently executin js code which contain data-api-client query to my table) will share the same "session" ?

If yes, is it an issues as regards "row locks" ?

Indeed I read here that :

Using transactions with InnoDB (auto-commit turned off), a SELECT ... FOR UPDATE allows one session to temporarily lock down a particular record (or records) so that no other session can update it.

So if SQL statement execution by lambda 1 sets a row lock but subsequent lambdas execution trying to read/writing theses rows SHARE the same session, will they be, as I wish, prevented from doing it thanks to the row lock?

If they're not prevent to read, that is to say if there's no row lock => is it possible to set up a row lock on aurora serverless MySQL while allowing improved performance thanks to keep-alive ?

Thanks for any help

jeremydaly commented 5 years ago

Sorry for the late reply. The keepAlive keeps the connection to the Data API HTTP endpoint open, the internal handling of queries is then managed by that system. I don't believe this will affect row locking at all.

misner commented 4 years ago

got it, thanks!