1. 22 May, 2019 1 commit
  2. 21 May, 2019 2 commits
  3. 13 Mar, 2019 1 commit
  4. 21 Feb, 2019 2 commits
    • Julien Muchembled's avatar
    • Julien Muchembled's avatar
      CMFActivity: new activate() parameter to prefer executing on the same node · 301962ad
      Julien Muchembled authored
      The goal is to make better use of the ZODB Storage cache. It is common to do
      processing on a data set in several sequential transactions: in such case, by
      continuing execution of these messages on the same node, data is loaded from
      ZODB only once. Without this, and if there are many other messages to process,
      processing always continue on a random node, causing much more load from ZODB.
      
      To prevent nodes from having too much work to do, or too little compared to
      other nodes, this new parameter is only a hint for CMFActivity. It remains
      possible for a node to execute a message that was intended for another node.
      
      Before this commit, a processing node selects the first message(s) according to
      the following ordering:
      
        priority, date
      
      and now:
      
        priority, node_preference, date
      
      where node_preference is:
      
        -1 -> same node
         0 -> no preferred node
         1 -> another node
      
      The implementation is tricky for 2 reasons:
      - MariaDB can't order this way in a single simple query, so we have 1
        subquery for each case, potentially getting 3 times the wanted maximum of
        messages, then order/filter on the resulting union.
      - MariaDB also can't filter efficiently messages for other nodes, so the 3rd
        subquery returns messages for any node, potentially duplicating results from
        the first 2 subqueries. This works because they'll be ordered last.
        Unfortunately, this requires extra indices.
      
      In any case, message reservation must be very efficient, or MariaDB deadlocks
      quickly happen, and locking an activity table during reservation reduces
      parallelism too much.
      
      In addition to better cache efficiency, this new feature can be used as a
      workaround for a bug affecting serialiation_tag, causing IntegrityError when
      reindexing many new objects. If you have 2 recursive reindexations for both a
      document and one of its lines, and if you have so many messages than grouping
      is split between these 2 messages, then you end up with 2 nodes indexing the
      same line in parallel: for some tables, the pattern DELETE+INSERT conflicts
      since InnoDB does not take any lock when deleting a non-existent row.
      
      If you have many activities creating such documents, you can combine with
      grouping and appropriate priority to make sure that such pair of messages won't
      be executed on different nodes, except maybe at the end (when there's no
      document to create anymore; then activity reexecution may be enough).
      For example:
      
        from Products.CMFActivity.ActivityTool import getCurrentNode
        portal.setPlacelessDefaultReindexParameters(
          activate_kw={'node': 'same', 'priority': priority},
          group_id=getCurrentNode())
      
      where `priority` is the same as the activity containing the above code, which
      can also use grouping without increasing the probability of IntegrityError.
      301962ad
  5. 05 Feb, 2019 4 commits
    • Julien Muchembled's avatar
      CMFActivity: remove old skin if any · afaa9d19
      Julien Muchembled authored
      afaa9d19
    • Julien Muchembled's avatar
      CMFActivity: remove processing/processing_date columns and improve watchers · 499d8f8b
      Julien Muchembled authored
      The original goal was to improve performance by removing the
      `processing_node_processing` index and the queries that modified
      these 2 useless columns.
      499d8f8b
    • Julien Muchembled's avatar
    • Julien Muchembled's avatar
      CMFActivity: validate a message with a single SQL request per queue · 7e387bcb
      Julien Muchembled authored
      As shown in the following example, on a big catalog table,
      MariaDB is able to use several indices at the same time
      ('...' are obfuscated unique values):
      
        > analyze select SQL_NO_CACHE uid, relative_url from catalog where reference='...' OR relative_url='...';
        +------+-------------+---------+-------------+------------------------+------------------------+---------+------+------+--------+----------+------------+--------------------------------------------------+
        | id   | select_type | table   | type        | possible_keys          | key                    | key_len | ref  | rows | r_rows | filtered | r_filtered | Extra                                            |
        +------+-------------+---------+-------------+------------------------+------------------------+---------+------+------+--------+----------+------------+--------------------------------------------------+
        |    1 | SIMPLE      | catalog | index_merge | Reference,relative_url | Reference,relative_url | 768,767 | NULL |    2 |   2.00 |   100.00 |     100.00 | Using union(Reference,relative_url); Using where |
        +------+-------------+---------+-------------+------------------------+------------------------+---------+------+------+--------+----------+------------+--------------------------------------------------+
        1 row in set (0.00 sec)
      
      So mixing different dependency types with OR should be fine
      (no need to split into more subqueries and join with UNION).
      7e387bcb
  6. 18 Jan, 2019 2 commits
  7. 03 Jul, 2018 2 commits
  8. 20 Jun, 2018 1 commit
  9. 16 May, 2018 1 commit
  10. 26 Apr, 2018 1 commit
  11. 06 Mar, 2018 2 commits
  12. 19 Feb, 2018 1 commit
  13. 29 Jun, 2017 1 commit
  14. 21 Apr, 2017 1 commit
  15. 23 Dec, 2016 1 commit
  16. 12 Jan, 2016 3 commits
  17. 28 Oct, 2015 1 commit
  18. 19 May, 2015 2 commits
  19. 15 May, 2015 1 commit
  20. 13 May, 2015 2 commits
  21. 06 May, 2015 1 commit
    • Julien Muchembled's avatar
      CMFActivity: slightly delay non-executed grouped messages · c85a840f
      Julien Muchembled authored
      When grouped messages fail, ActivityTool must distinguish 3 groups,
      in order to reexecute them separately, as follows:
      - first, those that succeeded
      - then, those that were skipped
      - at last, failed ones
      
      Grouping methods are updated to handle partial failures, and stop doing
      anything when something goes wrong.
      
      Without this, we would have the following pathological cases.
      
      1. Let's suppose first that skipped messages are marked as succeeded.
      
      The problem is that each skipped message that will fail causes the reexecution
      of those that didn't fail.
      
      Exemple: A:ok B:ok C:err D:err E:err F:err
        1: A:ok, B:ok, C:err, D:skipped, E:skipped, F:skipped
        2: A:ok, B:ok, D:err, E:skipped, F:skipped
        3: A:ok, B:ok, E:err, F:skipped
        4: A:ok, B:ok, F:err
        5: A:ok, B:ok -> commit
      
      And worst, the first failed (C) may be processable again before 5, entering
      a failing loop if it is executed again in the same group as A & B.
      
      2. Another implementation is to mar...
      c85a840f
  22. 30 Mar, 2015 2 commits
  23. 27 Mar, 2015 1 commit
    • Julien Muchembled's avatar
      CMFActivity: automatic migration of queues and removal of button to recreate tables · 3d644bde
      Julien Muchembled authored
      The action to recreate activity tables while preserving existing messages
      was unsafe for 2 reasons:
      - if any error happened, messages could be lost
      - it relied on Message.reactivate
      
      Which this patch, any instance created after commit d881edd1 (Aug 2010) will
      upgrade successfully. For older instances, make sure you have no activity left.
      
      For cases where 'ALTER TABLE' would not work, a better way to implement repair
      functionality would be:
      - one action to backup all messages in ZODB
      - and another to restore them
      And maybe a security so that during the backup-clear-restore sequence,
      activities can't be created nor processed.
      
      If any column is added in the future, it would still be possible to write code
      that fills them by inspecting messages.
      3d644bde
  24. 14 Oct, 2014 1 commit
  25. 08 Oct, 2014 1 commit
  26. 04 Sep, 2014 1 commit
  27. 29 Aug, 2014 1 commit