)]}'
{
  "commit": "dfed511cd627748046d90894f8600331413b1cd3",
  "tree": "1009fc7740d373f84ac8829ed598fc6a8bea51de",
  "parents": [
    "220e83e2c083b34ee77bc6cc7145027183ae9d00"
  ],
  "author": {
    "name": "Anderson Bravalheri",
    "email": "a.bravalheri@bristol.ac.uk",
    "time": "Fri Feb 08 01:44:14 2019 +0000"
  },
  "committer": {
    "name": "Anderson Bravalheri",
    "email": "a.bravalheri@bristol.ac.uk",
    "time": "Sun Feb 10 19:10:30 2019 +0000"
  },
  "message": "Improve race conditions/MySQL reconnection\n\nThis commit aims to provide a better synchronization between all the\ndifferent threads in RO, specially regarding DB usage and internal state\nconsistency.\n\nThe following improvements were done:\n\n1. Centralize database retry logic into a single function\n\n  This way we can change the procedure and the rules for retrying in a\n  single place and this reflects in several functions simultaneously\n  avoiding the need for manual copy and paste (and the potential risk of\n  forgetting to change somewhere)\n\n2. Minor fixes/improvements related to database connection loss.\n\n  Previously `db_base` was already able to identify when the connection\n  to MySQL was lost, but apparently in a few edge cases the automatic\n  reconnection was not done.\n\n3. Implement a transaction method\n\n  This method replaces the old context manager API for the connection\n  object that was removed from MySQLdb in version 1.4\n\n  In additional it is possible to use a decorator for transactions\n  (not only the context manager), which is handy sometimes.\n\n4. Add lock mechanism directly to db_base\n\n  This helps to improve synchronization between threads.\n  Some extra synchronization was introduced to functions, as it seemed\n  to be the case.\n  Moreover, previously, the cursor object was part of the internal state\n  of the db_base object, and it was being changed/used without thread\n  synchronization (error-prone). Having the locking mechanism around the\n  changes in the cursor property of the class, avoids problems.\n\n5. Add option to fork connection\n\n  Useful when independent threading is needed (as long as different\n  threads don\u0027t access the same database table, having separated\n  connections and locks should work fine).\n\nChange-Id: I3ab34df5e8c2857d96ed14a70e7f65bd0b5189a0\nSigned-off-by: Anderson Bravalheri \u003ca.bravalheri@bristol.ac.uk\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "a4cdef3bf6b36561c2e8ac897dbfb144ec9f8e25",
      "old_mode": 33188,
      "old_path": "osm_ro/db_base.py",
      "new_id": "58f5b8cfd0c635577a785612ed74e28a35a84606",
      "new_mode": 33188,
      "new_path": "osm_ro/db_base.py"
    },
    {
      "type": "modify",
      "old_id": "4b7ecc415ae12c9139bc90c5dbbd80b95c70bfae",
      "old_mode": 33188,
      "old_path": "osm_ro/nfvo.py",
      "new_id": "ebb30976c636430531291487307f6e64d3a38c9a",
      "new_mode": 33188,
      "new_path": "osm_ro/nfvo.py"
    },
    {
      "type": "modify",
      "old_id": "bad7cec2248fa86753571bc2a440f1f10c51ccf1",
      "old_mode": 33188,
      "old_path": "osm_ro/nfvo_db.py",
      "new_id": "d0abdf388f7172bec81ce73691e8a0d088f1afd1",
      "new_mode": 33188,
      "new_path": "osm_ro/nfvo_db.py"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "e152347e1b665355f301bdd58a38f9e79412b8c9",
      "new_mode": 33188,
      "new_path": "osm_ro/tests/test_db.py"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "c3a4e7af81865e27acc810b9419e7e1ef2821f99",
      "new_mode": 33188,
      "new_path": "osm_ro/tests/test_utils.py"
    },
    {
      "type": "modify",
      "old_id": "1e3a8ee74a8b283b7f847fa6fa7b4e5ea77f1a0a",
      "old_mode": 33188,
      "old_path": "osm_ro/utils.py",
      "new_id": "05c9801b76121296ad0579c7a9f8eee665d47450",
      "new_mode": 33188,
      "new_path": "osm_ro/utils.py"
    },
    {
      "type": "modify",
      "old_id": "d5301f1a6eafa3bf55fe3b4bea17537527dc731d",
      "old_mode": 33188,
      "old_path": "osm_ro/vim_thread.py",
      "new_id": "80024365a3ebc18b37133def435d484cf8f10879",
      "new_mode": 33188,
      "new_path": "osm_ro/vim_thread.py"
    },
    {
      "type": "modify",
      "old_id": "b956965b320b13b22b5bae327cbc73ae789e6253",
      "old_mode": 33188,
      "old_path": "osm_ro/wim/persistence.py",
      "new_id": "2e72640b6dc8f9c9107f61ae4702e8e7c68118c4",
      "new_mode": 33188,
      "new_path": "osm_ro/wim/persistence.py"
    },
    {
      "type": "modify",
      "old_id": "fb65fdd3a420c950f9cd1906d87aad9a042b4551",
      "old_mode": 33188,
      "old_path": "osm_ro/wim/schemas.py",
      "new_id": "6692ac5936a2572bb7d57f1463c0049304c154d7",
      "new_mode": 33188,
      "new_path": "osm_ro/wim/schemas.py"
    }
  ]
}
