I’m implementing a client for dgraph and by implementing transaction, I got questions.
Each client will need to keep a linearized reads (lin_read) map.
What if I have a pool of connections to dgraph database? How it should be handled, every connection should have own lin_read map or lin_read should be shared for all connections in a pool?
It can happen, that some client from the same node will get connection 1(from a pool) execute transaction with connection 1 and execute next transaction with connection 2, because in between of this transactions some other process will get connection 1 from a pool. The transaction will work, but it could happen, if every connection will have own
lin_read, that the same client will modify something in transaction 1(via connection 1) and willn’t see own modification in second transaction (via connection 2)?
Do I understand it right?
I see this solutions:
- track lin_read not only in a connection process, but in a working processes (so that the same process will never have smaller lin_read by getting another connection)
- having one lin_read, which will be single bottleneck for the client.
Thank you in advance for any clarification.