CMFActivity: simplify dependency query
@Nicolas triggered a validation node SQL error while processing a large number of activities with very varied after_tag
dependencies (1.8 distinct after_tag
values per activity, which seems to me to be quite an extreme case):
ProgrammingError: (1064, "memory exhausted near [...]")
With the current setup of 3 activity tables, and a limit of 1k activities being checked at a time, this meant there were 5400 UNION-joined subqueries in the total query.
When this situation occurs, it completely blocks all activity validation until human intevention. This error comes from the InnoDB SQL grammar parser (yacc).
Restricting to less than 3k will reduce performance somewhat (by increasing the number of query) because it is very likely for to-validate activities to have at least one dependency (ideally very little above 1 on average) each, so the limit should be somewhere above 3k and below 5.4k. 5k is verified to work for this query structure, so it seems a reasonable limit.
/cc @jm