Home > Back-end >  Single machine table transaction depend on the main table transaction issues? Such as child table tr
Single machine table transaction depend on the main table transaction issues? Such as child table tr

Time:11-29

In general is to have an operation on a page is dependent on the parent table state changes to control can be submitted, but now in a transaction, the operation of the parent table haven't submit, child table inserted into the large amounts of data need to half a minute to minute, because there is no change, the state of the parent table in page can repeat operation, repeat operation is brought about by the database inside a lot of repeating data, this have what way to solve?

CodePudding user response:

The main table to add a status field, isolate the main table, child table transaction (making the main table state can change alone)


Change the state of the main table (are submitting a table data), commit (consider increasing the lock line)
Increase the child table data, submit
Change the state of the main table (child table data submit completed), submit

CodePudding user response:

Add a record operation, 5 minutes are not allowed to repeat the operation,

CodePudding user response:

Single machine is locked, the cluster is distributed lock

CodePudding user response:

You can modify the state of the parent table for first row locks, then word table insert, repeat request will get stuck in a state that modify the parent table lock, without repeated injection
  • Related