ZBXNEXT-413 added maintenance processing to history syncers (creating event suppress records for problems that matches running maintenances). To avoid foreign key errors (when maintenance is removed by API while still being processed by server) history syncers lock running maintenanances for update in database. This introduces performance bottleneck - when a maintenance period is active history syncers has to process them sequentially.
To avoid this table based shared locks must be added. When processing maintenances history syncers (and timers) will request shared lock on maintenance table. It will allow parallel maintenance processing by syncers while preventing frontend from maintenance removal.