)]}'
{"nova/context.py":[{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"519b67567211bfe659f4f9ca84374b0f91a5a0ac","unresolved":false,"context_lines":[{"line_number":387,"context_line":"                context.mq_connection \u003d rpc.create_transport("},{"line_number":388,"context_line":"                    cell_mapping.transport_url)"},{"line_number":389,"context_line":"            CELL_CACHE[cell_mapping.uuid] \u003d (context.db_connection,"},{"line_number":390,"context_line":"                                             context.mq_connection)"},{"line_number":391,"context_line":"        else:"},{"line_number":392,"context_line":"            context.db_connection \u003d CELL_CACHE[cell_mapping.uuid][0]"},{"line_number":393,"context_line":"            context.mq_connection \u003d CELL_CACHE[cell_mapping.uuid][1]"}],"source_content_type":"text/x-python","patch_set":5,"id":"ff0f0b1f_e70dfe3e","line":390,"updated":"2017-05-18 15:55:04.000000000","message":"There\u0027s still a race here, in that two workers can fail the check on L382, get into this code to make a connection, and then one wins setting the thing in the dict. We can yield during the actually connection, letting another thread get a shot at it.\n\nTBH, I\u0027m not sure how this behaves differently with wsgi/eventlet.\n\nWe could:\n\n 1. Solve it with a lock around this code\n 2. Accept that we may waste a connection per cell per worker","commit_id":"ff387321caf3ef67bc5b3cd32d2c367e10909498"},{"author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"change_message_id":"7f8e410f54f72c24ce4e123909a4a7e00436a2bd","unresolved":false,"context_lines":[{"line_number":387,"context_line":"                context.mq_connection \u003d rpc.create_transport("},{"line_number":388,"context_line":"                    cell_mapping.transport_url)"},{"line_number":389,"context_line":"            CELL_CACHE[cell_mapping.uuid] \u003d (context.db_connection,"},{"line_number":390,"context_line":"                                             context.mq_connection)"},{"line_number":391,"context_line":"        else:"},{"line_number":392,"context_line":"            context.db_connection \u003d CELL_CACHE[cell_mapping.uuid][0]"},{"line_number":393,"context_line":"            context.mq_connection \u003d CELL_CACHE[cell_mapping.uuid][1]"}],"source_content_type":"text/x-python","patch_set":5,"id":"ff0f0b1f_b30f482d","line":390,"in_reply_to":"ff0f0b1f_e70dfe3e","updated":"2017-05-18 17:17:29.000000000","message":"you\u0027d have a race w/ eventlet or wsgi (threads), in the eventlet case the create_context_manager() is likely calling oslo.db\u0027s create_engine() which does an upfront connection ping, which is IO so there\u0027s your context switch.\n\ndepending on how often a uuid is expected to be present in CELL_CACHE vs. not present, you might want to use a try/CELL_CACHE[uuid]/KeyError approach to improve performance for the \"get when present\" case, then I\u0027d also do the lock around it.  There\u0027s a GIL in any case so the additional overhead of the lock is vanishingly small.    Whereas the initial pileup kind of problem often leads to hard to track bugs not to mention excess work being done.","commit_id":"ff387321caf3ef67bc5b3cd32d2c367e10909498"}],"nova/tests/unit/test_context.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"737b3bef9b519e7998bc27b8f3865d1049790e14","unresolved":false,"context_lines":[{"line_number":347,"context_line":"                                      uuid\u003duuids.cell)"},{"line_number":348,"context_line":"        # First call should create new connection objects."},{"line_number":349,"context_line":"        with context.target_cell(ctxt, mapping):"},{"line_number":350,"context_line":"            self.assertEqual(ctxt.db_connection, mock.sentinel.db_conn_obj)"},{"line_number":351,"context_line":"            self.assertEqual(ctxt.mq_connection, mock.sentinel.mq_conn_obj)"},{"line_number":352,"context_line":"        mock_create_cm.assert_called_once_with(\u0027fake://db\u0027)"},{"line_number":353,"context_line":"        mock_create_tport.assert_called_once_with(\u0027fake://mq\u0027)"},{"line_number":354,"context_line":"        # Second call should use cached objects."}],"source_content_type":"text/x-python","patch_set":4,"id":"ff0f0b1f_1dd741c2","line":351,"range":{"start_line":350,"start_character":12,"end_line":351,"end_character":75},"updated":"2017-05-17 23:51:13.000000000","message":"nit: normally would reverse these since it\u0027s (expected, actual) but won\u0027t block on it.","commit_id":"5d1395268ab111074873568eeb46df9eeb96ec10"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"606f9279dc047305d626fcf4f2df106495a85f1b","unresolved":false,"context_lines":[{"line_number":347,"context_line":"                                      uuid\u003duuids.cell)"},{"line_number":348,"context_line":"        # First call should create new connection objects."},{"line_number":349,"context_line":"        with context.target_cell(ctxt, mapping):"},{"line_number":350,"context_line":"            self.assertEqual(ctxt.db_connection, mock.sentinel.db_conn_obj)"},{"line_number":351,"context_line":"            self.assertEqual(ctxt.mq_connection, mock.sentinel.mq_conn_obj)"},{"line_number":352,"context_line":"        mock_create_cm.assert_called_once_with(\u0027fake://db\u0027)"},{"line_number":353,"context_line":"        mock_create_tport.assert_called_once_with(\u0027fake://mq\u0027)"},{"line_number":354,"context_line":"        # Second call should use cached objects."}],"source_content_type":"text/x-python","patch_set":4,"id":"ff0f0b1f_4f0f3c2e","line":351,"range":{"start_line":350,"start_character":12,"end_line":351,"end_character":75},"in_reply_to":"ff0f0b1f_1dd741c2","updated":"2017-05-18 00:02:32.000000000","message":"Done","commit_id":"5d1395268ab111074873568eeb46df9eeb96ec10"}],"releasenotes/notes/bug-1691545-1acd6512effbdffb.yaml":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"737b3bef9b519e7998bc27b8f3865d1049790e14","unresolved":false,"context_lines":[{"line_number":4,"context_line":"    Fixes `bug 1691545`_ in which there was a significant increase in database"},{"line_number":5,"context_line":"    connections because of the way connections to cell databases were being"},{"line_number":6,"context_line":"    established. With this fix, objects related to database connections are"},{"line_number":7,"context_line":"    cached and reused to prevent new connections being established for every"},{"line_number":8,"context_line":"    communication with cell databases."},{"line_number":9,"context_line":""},{"line_number":10,"context_line":"    .. _bug 1691545: https://bugs.launchpad.net/nova/+bug/1691545"}],"source_content_type":"text/x-yaml","patch_set":4,"id":"ff0f0b1f_1d006134","line":7,"range":{"start_line":7,"start_character":4,"end_line":7,"end_character":10},"updated":"2017-05-17 23:51:13.000000000","message":"cache in the API service?","commit_id":"5d1395268ab111074873568eeb46df9eeb96ec10"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"606f9279dc047305d626fcf4f2df106495a85f1b","unresolved":false,"context_lines":[{"line_number":4,"context_line":"    Fixes `bug 1691545`_ in which there was a significant increase in database"},{"line_number":5,"context_line":"    connections because of the way connections to cell databases were being"},{"line_number":6,"context_line":"    established. With this fix, objects related to database connections are"},{"line_number":7,"context_line":"    cached and reused to prevent new connections being established for every"},{"line_number":8,"context_line":"    communication with cell databases."},{"line_number":9,"context_line":""},{"line_number":10,"context_line":"    .. _bug 1691545: https://bugs.launchpad.net/nova/+bug/1691545"}],"source_content_type":"text/x-yaml","patch_set":4,"id":"ff0f0b1f_ef2730b6","line":7,"range":{"start_line":7,"start_character":4,"end_line":7,"end_character":10},"in_reply_to":"ff0f0b1f_1d006134","updated":"2017-05-18 00:02:32.000000000","message":"Done","commit_id":"5d1395268ab111074873568eeb46df9eeb96ec10"}]}
