LPS-44048

Hi Julio,

/cc @shuyangzhou

Here is the finally pull request for the trash entry clean up process. It does it with less DB queries than before since final solution is using LEFT JOIN to fetch TrashEntries.

It has been implemented at phases. 1st fix for 6.2.x that does not require DB change and then for 7.0 which require db change. 6.2 related commits are marked with "This is for 6.2.x backport".

Still the fix for 7.0 is still implemented way that it should be API level compatible with 6.2 version and old functionality still exists, when storing information to Group_ and TrashEntry.

One of the first things, when I started to do this I did realize there is no integration test for this and it is required. Integration test testing most of the use cases, but not use case with different companies are involved (that is tested only manually).

The transaction management and query has been implemented same ways as at BaseActionableQuery so it should  too, there is also limitation how many entries should be cleaned once.

The current 7.0 upgrade process seems to be broken so I did test only this Group and TrashEntry upgrades by looking the changes in database. Mvcc upgrade has not been implemented and I think it should be done also, but I think that is separate issue.

Let me know if you have any doubts