Skip to content

fixes BUG-46159: unstable DalLockingTest.lockedObjectShouldAllowChildrenCreation

This tests executes 2 threads:

  • T1: acquires a lock on an AlertRule and keeps running for a while (200ms)
  • T2: is executed after the lock is aquiered and inserts a recipient for the rule with the lock

The tests asserts T2 completes before than T1, ensuring in PG the lock is a FOR UPDATE NO KEY which allows insertions in child tables even there is a lock in the parent. It assumes T2 completes faster than the 200ms T1 waits after the lock is acquired.

In certain cases, it is possible T2 to take more than 200ms to do complete the instertion. In these cases T1 will finish before T2 making the test fail.

This commit fixes the problem by removing the fixed 200ms wait in T1 replacing it with a latch to wait for T2 to complete (or fail if it takes more than 10s, which never should be the case).

On top:

  • It adds some timing information to the logs
  • fixes a typo in waitUntil method name

Try run

Edited by Asier Lostalé

Merge request reports