)]}'
{"swift/common/db_replicator.py":[{"author":{"_account_id":23630,"name":"Tovin Seven","email":"tovin07@gmail.com","username":"tovin07"},"change_message_id":"76c0db695fe41b8a3f4053b2ce08b071b77ca6be","unresolved":false,"context_lines":[{"line_number":441,"context_line":"        elif 200 \u003c\u003d response.status \u003c 300:"},{"line_number":442,"context_line":"            rinfo \u003d json.loads(response.data)"},{"line_number":443,"context_line":"            local_sync \u003d broker.get_sync(rinfo[\u0027id\u0027], incoming\u003dFalse)"},{"line_number":444,"context_line":"            if rinfo.get(\u0027metadata\u0027, \u0027\u0027):"},{"line_number":445,"context_line":"                try:"},{"line_number":446,"context_line":"                    rmeta \u003d json.loads(rinfo[\u0027metadata\u0027])"},{"line_number":447,"context_line":"                except ValueError:"},{"line_number":448,"context_line":"                    pass"},{"line_number":449,"context_line":"                else:"},{"line_number":450,"context_line":"                    broker.update_metadata(rmeta)"},{"line_number":451,"context_line":"            if self._in_sync(rinfo, info, broker, local_sync):"},{"line_number":452,"context_line":"                return True"},{"line_number":453,"context_line":"            # if the difference in rowids between the two differs by"}],"source_content_type":"text/x-python","patch_set":2,"id":"3f044301_1c48c684","line":450,"range":{"start_line":444,"start_character":0,"end_line":450,"end_character":49},"updated":"2017-05-12 04:01:27.000000000","message":"Just simple like this and no need to try/catch/else and if/else.\n    broker.update_metadata(json.loads(rinfo.get(\u0027metadata\u0027, \u0027{}\u0027)))","commit_id":"98fd7917478fb14c7fab57af8ce80cc3f8e89180"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"1270dcfb818197e402eecb88121d3d8f01517634","unresolved":false,"context_lines":[{"line_number":441,"context_line":"        elif 200 \u003c\u003d response.status \u003c 300:"},{"line_number":442,"context_line":"            rinfo \u003d json.loads(response.data)"},{"line_number":443,"context_line":"            local_sync \u003d broker.get_sync(rinfo[\u0027id\u0027], incoming\u003dFalse)"},{"line_number":444,"context_line":"            if rinfo.get(\u0027metadata\u0027, \u0027\u0027):"},{"line_number":445,"context_line":"                try:"},{"line_number":446,"context_line":"                    rmeta \u003d json.loads(rinfo[\u0027metadata\u0027])"},{"line_number":447,"context_line":"                except ValueError:"},{"line_number":448,"context_line":"                    pass"},{"line_number":449,"context_line":"                else:"},{"line_number":450,"context_line":"                    broker.update_metadata(rmeta)"},{"line_number":451,"context_line":"            if self._in_sync(rinfo, info, broker, local_sync):"},{"line_number":452,"context_line":"                return True"},{"line_number":453,"context_line":"            # if the difference in rowids between the two differs by"}],"source_content_type":"text/x-python","patch_set":2,"id":"1f013ff3_81ef7e86","line":450,"range":{"start_line":444,"start_character":0,"end_line":450,"end_character":49},"in_reply_to":"3f044301_1c48c684","updated":"2017-05-12 17:50:26.000000000","message":"Yeah, part of this grew out of a bad mock response (which couldn\u0027t be parsed as json) that happened in a test in (a previous patchset of) https://review.openstack.org/#/c/302494/. The more I think about it, the more that seems silly: the test was bad, we fixed the test, and the actual sync responses should never get us a non-string \u0027metadata\u0027 field.\n\nAlso, good thought on how to be defensive of a missing key -- but I\u0027m a bit worried about us getting responses from old container DBs that have never received metadata. get_metadata_raw has some handling for that[1], but it means we\u0027ll still get back a dict like {\u0027metadata\u0027: \u0027\u0027}, and the loads(\u0027\u0027) will raise a ValueError. So I think we should keep the\n\n if rinfo.get(\u0027metadata\u0027, \u0027\u0027):\n\ncheck, but I\u0027ll scrap the try/except for sure.\n\n[1] https://github.com/openstack/swift/blob/2.14.0/swift/common/db.py#L709-L718","commit_id":"98fd7917478fb14c7fab57af8ce80cc3f8e89180"}],"test/probe/test_db_replicator.py":[{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"7a8d67128a3cc7206c2a0c6117a6f514a9fcd42c","unresolved":false,"context_lines":[{"line_number":98,"context_line":"            \u0027x-container-meta-e\u0027: \u00273\u0027,"},{"line_number":99,"context_line":"        }"},{"line_number":100,"context_line":""},{"line_number":101,"context_line":"        # node that got the object updates now has the meta"},{"line_number":102,"context_line":"        resp_headers \u003d direct_client.direct_head_container("},{"line_number":103,"context_line":"            cnode, cpart, self.account, container)"},{"line_number":104,"context_line":"        for header, value in expected_meta.items():"},{"line_number":105,"context_line":"            self.assertIn(header, resp_headers)"},{"line_number":106,"context_line":"            self.assertEqual(value, resp_headers[header])"},{"line_number":107,"context_line":"        self.assertNotIn(resp_headers.get(\u0027x-container-object-count\u0027),"},{"line_number":108,"context_line":"                         (None, \u00270\u0027, 0))"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"        # other nodes still have the meta, as well as objects"},{"line_number":111,"context_line":"        for node in cnodes:"}],"source_content_type":"text/x-python","patch_set":3,"id":"df7087c5_30bc8b04","line":108,"range":{"start_line":101,"start_character":0,"end_line":108,"end_character":40},"updated":"2018-03-07 18:53:21.000000000","message":"is this still needed? you could add cnode to the list of nodes tested below","commit_id":"6f438f0caa1fcac91cec4e21b6c107c79d054028"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"7a8d67128a3cc7206c2a0c6117a6f514a9fcd42c","unresolved":false,"context_lines":[{"line_number":108,"context_line":"                         (None, \u00270\u0027, 0))"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"        # other nodes still have the meta, as well as objects"},{"line_number":111,"context_line":"        for node in cnodes:"},{"line_number":112,"context_line":"            resp_headers \u003d direct_client.direct_head_container("},{"line_number":113,"context_line":"                node, cpart, self.account, container)"},{"line_number":114,"context_line":"            for header, value in expected_meta.items():"}],"source_content_type":"text/x-python","patch_set":3,"id":"df7087c5_d05f4fe3","line":111,"range":{"start_line":111,"start_character":8,"end_line":111,"end_character":26},"updated":"2018-03-07 18:53:21.000000000","message":"seems like a good place to use with annotate_failure (except that\u0027s not on master...)\n\n  for node in cnodes + [cnode]:","commit_id":"6f438f0caa1fcac91cec4e21b6c107c79d054028"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"7a8d67128a3cc7206c2a0c6117a6f514a9fcd42c","unresolved":false,"context_lines":[{"line_number":33,"context_line":"                             headers\u003d{\u0027X-Storage-Policy\u0027: self.policy.name,"},{"line_number":34,"context_line":"                                      \u0027X-Container-Meta-A\u0027: \u00271\u0027,"},{"line_number":35,"context_line":"                                      \u0027X-Container-Meta-B\u0027: \u00271\u0027,"},{"line_number":36,"context_line":"                                      \u0027X-Container-Meta-C\u0027: \u00271\u0027})"},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"        cpart, cnodes \u003d self.container_ring.get_nodes(self.account, container)"},{"line_number":39,"context_line":"        cnode \u003d cnodes.pop()"}],"source_content_type":"text/x-python","patch_set":4,"id":"df7087c5_30c6cb69","line":36,"range":{"start_line":36,"start_character":38,"end_line":36,"end_character":63},"updated":"2018-03-07 18:53:21.000000000","message":"nit: add some sysmeta for completeness","commit_id":"b640631dafefe4f03f6ce2f9fe723e262cf366e4"}],"test/unit/common/test_db_replicator.py":[{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"7a8d67128a3cc7206c2a0c6117a6f514a9fcd42c","unresolved":false,"context_lines":[{"line_number":1495,"context_line":""},{"line_number":1496,"context_line":"    def test_repl_to_node_metadata_update(self):"},{"line_number":1497,"context_line":"        now \u003d Timestamp(time.time()).internal"},{"line_number":1498,"context_line":"        rmetadata \u003d {\"X-Container-Sysmeta-Test\": (\"XYZ\", now)}"},{"line_number":1499,"context_line":"        rinfo \u003d {\"id\": 3, \"point\": -1, \"max_row\": 20, \"hash\": \"b\","},{"line_number":1500,"context_line":"                 \"metadata\": json.dumps(rmetadata)}"},{"line_number":1501,"context_line":"        self.http \u003d ReplHttp(json.dumps(rinfo))"}],"source_content_type":"text/x-python","patch_set":4,"id":"df7087c5_90b557f1","line":1498,"range":{"start_line":1498,"start_character":8,"end_line":1498,"end_character":62},"updated":"2018-03-07 18:53:21.000000000","message":"nit: we could add some user meta here for completeness","commit_id":"b640631dafefe4f03f6ce2f9fe723e262cf366e4"}]}
