fix locking in MergeOperation addRows
fix group by queries on system tables with limit or the same aggregation twice