-
Aditya A authored
PROBLEM ------- Whenever an fts table is created it registers itself in a queue which is operated by a background thread whose job is to optimize the fts tables in background. Additionally we place these fts tables in non-LRU list so that they cannot be evicted from cache. But in the scenario when a node is brought up which is already having fts tables ,we first try to load the fts tables in dictionary ,but we skip the part where it is added in background queue and in non-LRU list because the background thread is not yet created,so these tables are loaded but they can be evicted from the cache. Now coming to the deadlock scenario 1. A Server background thread is trying to evict a table from the cache because the cache is full,so it scans the LRU list for the tables it can evict.It finds the fts table (because of the reason explained above) can be evicted and it takes the dict_sys->mutex (this is a system wide mutex) submits a request to the background thread to remove this table from queue and waits it to be completed. 2. In the mean time fts_optimize_thread() is processing another job in the queue and needs dict_sys->mutex for a small amount of time, but it cannot get it because it is blocked by the first background thread. So Thread 1 is waiting for its job to be completed by Thread 2,whereas Thread 2 is waiting for dict_sys->mutex held by thread 1 ,causing the deadlock. FIX
280879eb