I am trying to test a scenario in table locked cases.
I tried to apply read and write locks like these -
mysql> lock tables table_name write;
Query OK, 0 rows affected (0.01 sec)
But was able to write after this -
mysql> insert into table_name (id) values (1000000023);
Query OK, 1 row affected (0.00 sec)
Read lock is also not working. I was able to do a select query successfully after applying lock.
I need to test my application behaviour (restful APIs) when we do a table migration of large amount of data, when there may be write locks applied on the table. So, I guess, if I am able to set the lock via command line, it will apply to my APIs as well. I am using the same user to login to command line as I am using in my application to login to mysql.
Please let me know if I am missing something.
The table is InnoDb type.