We have a problem where my code(war file) running in two different serers will try to read same data from single Mysql DB. I want to lock ROWS in a table when one thread reads them. The other should wait until the first thread releases lock on that row. Can I lock ONLY ROWS in MYSQL DB, without locking the entire table. Is there a way to enable ROW level locking in MYSQL. Also, please suggest if we can achieve this behavour in any other way. We are trying to achieve high-availability in our application, where if one server goes down, the other will still read data from DB for assigning jobs. Also, please suggest if we can achieve it without using locking mechanism itself.
Note: MYSQL8 is providing row level locks, but it is not possible for us to upgrade.