Deadlock problem caused by locking sequence

in order to prevent deadlocks, I locked my program sequentially. Such as the order of oa--as-aa. But since I found that the data did not exist when I got the OA, I first new, and then lock it. The result is the new oa- lock, the oa-new as- lock, the as-new aa- lock, the aa lock. But if it goes on like this, there will be a deadlock. What"s the reason? (oa and as locks use exclusive locks, while aa locks use shared locks)

I do this by adding MySQL row-level locks, for update and in share mode, without locking to the same variable.

Apr.18,2021

is the lock nested? Is it locked to the same variable? Is
deadlocked in the second step?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37f47-2b43b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37f47-2b43b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?