)]}'
{"swift/cli/ringbuilder.py":[{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"cfe996ccfa3595952d1d0005f40289bbfa650821","unresolved":false,"context_lines":[{"line_number":469,"context_line":"        try:"},{"line_number":470,"context_line":"            builder_id \u003d builder.id"},{"line_number":471,"context_line":"        except AttributeError:"},{"line_number":472,"context_line":"            builder_id \u003d \"not assigned\""},{"line_number":473,"context_line":"        print(\u0027%s, build version %d, id %s\u0027 %"},{"line_number":474,"context_line":"              (builder_file, builder.version, builder_id))"},{"line_number":475,"context_line":"        regions \u003d 0"}],"source_content_type":"text/x-python","patch_set":7,"id":"bff0334d_751fb507","line":472,"updated":"2017-04-12 07:30:49.000000000","message":"Could we have bracket to clarify? I think current message can be like natural sentence as \"id not assigned\".\n(i mean, \"id (not assigned)\" or something may be better?)","commit_id":"0685fb465da29a6e0fbd932a3eb1e96c6187adc0"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"0f7ceda516a139002662f124d73e03a3e4c92fe9","unresolved":false,"context_lines":[{"line_number":469,"context_line":"        try:"},{"line_number":470,"context_line":"            builder_id \u003d builder.id"},{"line_number":471,"context_line":"        except AttributeError:"},{"line_number":472,"context_line":"            builder_id \u003d \"not assigned\""},{"line_number":473,"context_line":"        print(\u0027%s, build version %d, id %s\u0027 %"},{"line_number":474,"context_line":"              (builder_file, builder.version, builder_id))"},{"line_number":475,"context_line":"        regions \u003d 0"}],"source_content_type":"text/x-python","patch_set":7,"id":"bff0334d_35435b44","line":472,"in_reply_to":"bff0334d_751fb507","updated":"2017-04-12 17:11:03.000000000","message":"Done","commit_id":"0685fb465da29a6e0fbd932a3eb1e96c6187adc0"}],"swift/common/ring/builder.py":[{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"366f8648ba5597a7facad24e0b253fb2300eb54e","unresolved":false,"context_lines":[{"line_number":96,"context_line":"        self.devs_changed \u003d False"},{"line_number":97,"context_line":"        self.version \u003d 0"},{"line_number":98,"context_line":"        self.overload \u003d 0.0"},{"line_number":99,"context_line":"        self._id \u003d None"},{"line_number":100,"context_line":"        if assign_id:"},{"line_number":101,"context_line":"            self.assign_id()"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"        # _replica2part2dev maps from replica number to partition number to"},{"line_number":104,"context_line":"        # device id. So, for a three replica, 2**23 ring, it\u0027s an array of"}],"source_content_type":"text/x-python","patch_set":5,"id":"dfeb2761_1629cee4","line":101,"range":{"start_line":99,"start_character":0,"end_line":101,"end_character":28},"updated":"2017-04-05 08:40:34.000000000","message":"From etherpad discussion, I think all we need here is only to set self._id \u003d None. If the self._id is None, the new uuid will be created at the time calling \"save\" method.\n\nAnd only one other part we can set self._id is \"load\" method if the builder file includes the id info in the persistent .builder file.","commit_id":"271d5c24bdfb990e6800c45efa740a9f6cf932a1"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"d0d2c44b0cc576415dad3b7fc65cdf824335be7f","unresolved":false,"context_lines":[{"line_number":155,"context_line":"            # We don\u0027t automatically assign an id here because we want a caller"},{"line_number":156,"context_line":"            # to explicitly know when a builder needs an id to be assigned. In"},{"line_number":157,"context_line":"            # that case the caller should use assign_id() and then save the"},{"line_number":158,"context_line":"            # builder in order that the newly assigned id is persisted."},{"line_number":159,"context_line":"            raise AttributeError("},{"line_number":160,"context_line":"                \u0027id attribute has not been initialised with assign_id()\u0027)"},{"line_number":161,"context_line":"        return self._id"}],"source_content_type":"text/x-python","patch_set":5,"id":"dfeb2761_108c4d34","line":158,"updated":"2017-04-04 15:42:20.000000000","message":"I\u0027m not *pleased* about this but it seemed least bad of the options for ensuring callers think about saving id\u0027s assigned to existing builders:\n\n- automatically assign ids whenever this property is accessed. Hope the caller always save the builder just in case. [too opaque]\n\n- automatically assign ids whenever this property is accessed. Provide a \u0027modified\u0027 flag for caller to check if id was actually assigned, if so caller should save to file [too passive]\n\n- don\u0027t even provide assign_id() - require caller to save the builder if the builder has no id - i.e. only assign in __init__ (new builder) or in save (old builder) [too aggressive? but this is the safest option]\n\n- only assign ids to new builders in the __init__ [too backwards incompatible]","commit_id":"271d5c24bdfb990e6800c45efa740a9f6cf932a1"},{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"cfe996ccfa3595952d1d0005f40289bbfa650821","unresolved":false,"context_lines":[{"line_number":138,"context_line":"            # that case the caller must save the builder in order that a newly"},{"line_number":139,"context_line":"            # assigned id is persisted."},{"line_number":140,"context_line":"            raise AttributeError("},{"line_number":141,"context_line":"                \u0027id attribute has not been initialised with assign_id()\u0027)"},{"line_number":142,"context_line":"        return self._id"},{"line_number":143,"context_line":""},{"line_number":144,"context_line":"    @property"}],"source_content_type":"text/x-python","patch_set":7,"id":"bff0334d_b5b77df5","line":141,"range":{"start_line":141,"start_character":17,"end_line":141,"end_character":71},"updated":"2017-04-12 07:30:49.000000000","message":"The message is stale, we have no assign_id method anymore.","commit_id":"0685fb465da29a6e0fbd932a3eb1e96c6187adc0"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"0f7ceda516a139002662f124d73e03a3e4c92fe9","unresolved":false,"context_lines":[{"line_number":138,"context_line":"            # that case the caller must save the builder in order that a newly"},{"line_number":139,"context_line":"            # assigned id is persisted."},{"line_number":140,"context_line":"            raise AttributeError("},{"line_number":141,"context_line":"                \u0027id attribute has not been initialised with assign_id()\u0027)"},{"line_number":142,"context_line":"        return self._id"},{"line_number":143,"context_line":""},{"line_number":144,"context_line":"    @property"}],"source_content_type":"text/x-python","patch_set":7,"id":"bff0334d_b59d2bbd","line":141,"range":{"start_line":141,"start_character":17,"end_line":141,"end_character":71},"in_reply_to":"bff0334d_b5b77df5","updated":"2017-04-12 17:11:03.000000000","message":"Done","commit_id":"0685fb465da29a6e0fbd932a3eb1e96c6187adc0"},{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"cfe996ccfa3595952d1d0005f40289bbfa650821","unresolved":false,"context_lines":[{"line_number":1674,"context_line":"            builder.copy_from(builder_dict)"},{"line_number":1675,"context_line":""},{"line_number":1676,"context_line":"        if not hasattr(builder, \u0027_id\u0027):"},{"line_number":1677,"context_line":"            builder._id \u003d None"},{"line_number":1678,"context_line":""},{"line_number":1679,"context_line":"        for dev in builder.devs:"},{"line_number":1680,"context_line":"            # really old rings didn\u0027t have meta keys"}],"source_content_type":"text/x-python","patch_set":7,"id":"bff0334d_10d51744","line":1677,"updated":"2017-04-12 07:30:49.000000000","message":"Off-topic:\n\nAt first, I was wondering why we need to address the legacy builder file here because I was thinking copy_from dict can address both case the builder is the legacy builder instance and builder dict. However, I was wrong because we call builder.copy_from ONLY WHEN the builder is a dict instance.\n\nAnd then, I got another question here, whether copy_from method is used for both cases? The answer I got is no. In the master, no test fails when I remove the code that addressing builder instance case in copy_from method around tests/unit/common/ring. (only a test with this branch fails because Alistair adds the test for copy_from case, and not yet ran whole tests yet though) I don\u0027t know the reason and I don\u0027t know who one else is using the copy_from method to create a new builder instance.\n\nHowever, \n\n1. do we need to keep the copy_from method behavior that can copy from builder instance to builder instance?\n\n2. if we keep it, just using copy_from (a legacy builder to a new builder) could be enough?\n\nI\u0027m still wondering.","commit_id":"0685fb465da29a6e0fbd932a3eb1e96c6187adc0"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"0f7ceda516a139002662f124d73e03a3e4c92fe9","unresolved":false,"context_lines":[{"line_number":1674,"context_line":"            builder.copy_from(builder_dict)"},{"line_number":1675,"context_line":""},{"line_number":1676,"context_line":"        if not hasattr(builder, \u0027_id\u0027):"},{"line_number":1677,"context_line":"            builder._id \u003d None"},{"line_number":1678,"context_line":""},{"line_number":1679,"context_line":"        for dev in builder.devs:"},{"line_number":1680,"context_line":"            # really old rings didn\u0027t have meta keys"}],"source_content_type":"text/x-python","patch_set":7,"id":"bff0334d_35fb5bc1","line":1677,"in_reply_to":"bff0334d_10d51744","updated":"2017-04-12 17:11:03.000000000","message":"I needed these two lines ^^ because if you unpickle a very old ring builder then you unpickle a RingBuilder class not a dict, and AFAIK unpickling does not call the class __init__ so you would not have an _id attribute on the instance.\n\nBut (off-topic) what I was wondering was whether here [1] we should always construct a new instance and call copy_from, which can deal with the source being either a dict or a class, to ensure we get an instance of the current class.\n\n[1] https://github.com/openstack/swift/blob/0685fb465da29a6e0fbd932a3eb1e96c6187adc0/swift/common/ring/builder.py#L1671-L1674","commit_id":"0685fb465da29a6e0fbd932a3eb1e96c6187adc0"},{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"d9c1e80a004200646a1831c593538d01c6d29fc1","unresolved":false,"context_lines":[{"line_number":1674,"context_line":"            builder.copy_from(builder_dict)"},{"line_number":1675,"context_line":""},{"line_number":1676,"context_line":"        if not hasattr(builder, \u0027_id\u0027):"},{"line_number":1677,"context_line":"            builder._id \u003d None"},{"line_number":1678,"context_line":""},{"line_number":1679,"context_line":"        for dev in builder.devs:"},{"line_number":1680,"context_line":"            # really old rings didn\u0027t have meta keys"}],"source_content_type":"text/x-python","patch_set":7,"id":"9ff52f3f_a84c9a76","line":1677,"in_reply_to":"bff0334d_35fb5bc1","updated":"2017-04-13 05:12:32.000000000","message":"Yup, if we would use copy_from against to both builder and dict, we can do, 1) create new instance, 2) call copy_from for both cases. When I tried to do that tentatively, some tests seem to fail so I need more time to dig the failing tests though.","commit_id":"0685fb465da29a6e0fbd932a3eb1e96c6187adc0"},{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"cfe996ccfa3595952d1d0005f40289bbfa650821","unresolved":false,"context_lines":[{"line_number":1701,"context_line":"        # We want to be sure the builder id\u0027s are persistent, so this is the"},{"line_number":1702,"context_line":"        # only place where the id is assigned. Newly created instances of this"},{"line_number":1703,"context_line":"        # class, or instances loaded from legacy builder files that have no"},{"line_number":1704,"context_line":"        # persisted id, must be saved in order for an id to be assigned."},{"line_number":1705,"context_line":"        try:"},{"line_number":1706,"context_line":"            self._assign_id()"},{"line_number":1707,"context_line":"            with open(builder_file, \u0027wb\u0027) as f:"}],"source_content_type":"text/x-python","patch_set":7,"id":"bff0334d_904da73f","line":1704,"updated":"2017-04-12 07:30:49.000000000","message":"Thinking of the context that this is only the place we can create the new id, we may not have to make _assign_id method out of this method that can be callable other methods. Thought?","commit_id":"0685fb465da29a6e0fbd932a3eb1e96c6187adc0"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"0f7ceda516a139002662f124d73e03a3e4c92fe9","unresolved":false,"context_lines":[{"line_number":1701,"context_line":"        # We want to be sure the builder id\u0027s are persistent, so this is the"},{"line_number":1702,"context_line":"        # only place where the id is assigned. Newly created instances of this"},{"line_number":1703,"context_line":"        # class, or instances loaded from legacy builder files that have no"},{"line_number":1704,"context_line":"        # persisted id, must be saved in order for an id to be assigned."},{"line_number":1705,"context_line":"        try:"},{"line_number":1706,"context_line":"            self._assign_id()"},{"line_number":1707,"context_line":"            with open(builder_file, \u0027wb\u0027) as f:"}],"source_content_type":"text/x-python","patch_set":7,"id":"bff0334d_d0667dbb","line":1704,"in_reply_to":"bff0334d_904da73f","updated":"2017-04-12 17:11:03.000000000","message":"Done","commit_id":"0685fb465da29a6e0fbd932a3eb1e96c6187adc0"},{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"cfe996ccfa3595952d1d0005f40289bbfa650821","unresolved":false,"context_lines":[{"line_number":1707,"context_line":"            with open(builder_file, \u0027wb\u0027) as f:"},{"line_number":1708,"context_line":"                pickle.dump(self.to_dict(), f, protocol\u003d2)"},{"line_number":1709,"context_line":"        except Exception:"},{"line_number":1710,"context_line":"            self._id \u003d None"},{"line_number":1711,"context_line":"            raise"},{"line_number":1712,"context_line":""},{"line_number":1713,"context_line":"    def search_devs(self, search_values):"}],"source_content_type":"text/x-python","patch_set":7,"id":"bff0334d_70f6a3d9","line":1710,"updated":"2017-04-12 07:30:49.000000000","message":"I don\u0027t think this is robust. Because the persistent id can be lost.\n\nThe scenario I concern is:\n\n1. save a ring builder (that has had uuid since this time)\n2. load the builder (ok, this has uuid created at 1)\n3. save the ring builder but fails with IOError\n4. the builder has no id (current code, OMG)\n\nA possible solution is here, https://gist.github.com/bloodeagle40234/bd35ca24fc59403a48ec1ceebc013a20","commit_id":"0685fb465da29a6e0fbd932a3eb1e96c6187adc0"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"0f7ceda516a139002662f124d73e03a3e4c92fe9","unresolved":false,"context_lines":[{"line_number":1707,"context_line":"            with open(builder_file, \u0027wb\u0027) as f:"},{"line_number":1708,"context_line":"                pickle.dump(self.to_dict(), f, protocol\u003d2)"},{"line_number":1709,"context_line":"        except Exception:"},{"line_number":1710,"context_line":"            self._id \u003d None"},{"line_number":1711,"context_line":"            raise"},{"line_number":1712,"context_line":""},{"line_number":1713,"context_line":"    def search_devs(self, search_values):"}],"source_content_type":"text/x-python","patch_set":7,"id":"bff0334d_700d71e6","line":1710,"in_reply_to":"bff0334d_70f6a3d9","updated":"2017-04-12 17:11:03.000000000","message":"Done thanks for diff","commit_id":"0685fb465da29a6e0fbd932a3eb1e96c6187adc0"}],"swift/common/ring/composite_builder.py":[{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"0eb3934bcf93360a1074e6977f3fea1a3a856614","unresolved":false,"context_lines":[{"line_number":99,"context_line":""},{"line_number":100,"context_line":""},{"line_number":101,"context_line":"def _make_component_fixed_metadata(builder):"},{"line_number":102,"context_line":"    # return a dict of selected builder attributes that should never change"},{"line_number":103,"context_line":"    builder_hash \u003d md5("},{"line_number":104,"context_line":"        pickle.dumps(builder.to_dict(), protocol\u003d2)).hexdigest()"},{"line_number":105,"context_line":"    return{\u0027hash\u0027: builder_hash}"}],"source_content_type":"text/x-python","patch_set":1,"id":"ffe62b97_936fc0c4","line":102,"range":{"start_line":102,"start_character":23,"end_line":102,"end_character":40},"updated":"2017-03-24 10:06:00.000000000","message":"This is not *selected* attributes but whole info of the builder, right?\n\nAh, it\u0027s NOT. *NOW* this returns only *hash* but the keys (in the future) in the returned dict will be items that we expects them as never change.","commit_id":"0a3c19e75a5a3ccedc8efd1510ebc404e47ff6f0"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"9a830b9b083336679e789e9160474fd78c49c216","unresolved":false,"context_lines":[{"line_number":99,"context_line":""},{"line_number":100,"context_line":""},{"line_number":101,"context_line":"def _make_component_fixed_metadata(builder):"},{"line_number":102,"context_line":"    # return a dict of selected builder attributes that should never change"},{"line_number":103,"context_line":"    builder_hash \u003d md5("},{"line_number":104,"context_line":"        pickle.dumps(builder.to_dict(), protocol\u003d2)).hexdigest()"},{"line_number":105,"context_line":"    return{\u0027hash\u0027: builder_hash}"}],"source_content_type":"text/x-python","patch_set":1,"id":"ffe62b97_a60ef5e2","line":102,"range":{"start_line":102,"start_character":23,"end_line":102,"end_character":40},"in_reply_to":"ffe62b97_936fc0c4","updated":"2017-03-24 11:31:35.000000000","message":"sorry, the comment was confusing\n\nthis method should return whatever we consider to be immutable properties of the builder, properties that can be used to assert \"the builder used to compose the current composite ring is the same as this other instance of a builder\" where same means same builder file but *not necessarily the same version*\n\nwe need this to detect this error:\n\n  compositeX \u003d compose(builderA, builderB)\n  rebalance builder A\n  compositeX \u003d compose(builderB, builderA\u0027) \u003c--- OOPS! disallow re-ordering\n\nbut we should allow this:\n\n  compositeX \u003d compose(builderA, builderB)\n  rebalance builderA -\u003e builderA\u0027\n  compositeX \u003d compose(builderA\u0027, builderB) \u003c-- ok to use new version of builderA in same position","commit_id":"0a3c19e75a5a3ccedc8efd1510ebc404e47ff6f0"},{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"0eb3934bcf93360a1074e6977f3fea1a3a856614","unresolved":false,"context_lines":[{"line_number":100,"context_line":""},{"line_number":101,"context_line":"def _make_component_fixed_metadata(builder):"},{"line_number":102,"context_line":"    # return a dict of selected builder attributes that should never change"},{"line_number":103,"context_line":"    builder_hash \u003d md5("},{"line_number":104,"context_line":"        pickle.dumps(builder.to_dict(), protocol\u003d2)).hexdigest()"},{"line_number":105,"context_line":"    return{\u0027hash\u0027: builder_hash}"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"ffe62b97_1a517cd9","line":104,"range":{"start_line":103,"start_character":4,"end_line":104,"end_character":64},"updated":"2017-03-24 10:06:00.000000000","message":"Now, I\u0027m realizing md5 is worse choice, please see my comment in the parent patch. Perhaps, instead, uuid + builder version can be used? it may be duplicate info in the normal component_metadata, though.","commit_id":"0a3c19e75a5a3ccedc8efd1510ebc404e47ff6f0"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"9a830b9b083336679e789e9160474fd78c49c216","unresolved":false,"context_lines":[{"line_number":100,"context_line":""},{"line_number":101,"context_line":"def _make_component_fixed_metadata(builder):"},{"line_number":102,"context_line":"    # return a dict of selected builder attributes that should never change"},{"line_number":103,"context_line":"    builder_hash \u003d md5("},{"line_number":104,"context_line":"        pickle.dumps(builder.to_dict(), protocol\u003d2)).hexdigest()"},{"line_number":105,"context_line":"    return{\u0027hash\u0027: builder_hash}"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"ffe62b97_66e6ad19","line":104,"range":{"start_line":103,"start_character":4,"end_line":104,"end_character":64},"in_reply_to":"ffe62b97_1a517cd9","updated":"2017-03-24 11:31:35.000000000","message":"whatever attrs we end up including in the \u0027fixed_metadata\u0027 become a subset of the component metadata, so we just remove them from any list of atts t line 110","commit_id":"0a3c19e75a5a3ccedc8efd1510ebc404e47ff6f0"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"9a830b9b083336679e789e9160474fd78c49c216","unresolved":false,"context_lines":[{"line_number":107,"context_line":""},{"line_number":108,"context_line":"def _make_component_metadata(builder):"},{"line_number":109,"context_line":"    # return a dict of selected builder attributes"},{"line_number":110,"context_line":"    attrs \u003d []  # TODO choose attrs e.g. [\u0027version\u0027, \u0027part_power\u0027, \u0027replicas\u0027]"},{"line_number":111,"context_line":"    metadata \u003d dict((attr, getattr(builder, attr)) for attr in attrs)"},{"line_number":112,"context_line":"    metadata.update(_make_component_fixed_metadata(builder))"},{"line_number":113,"context_line":"    return metadata"}],"source_content_type":"text/x-python","patch_set":1,"id":"ffe62b97_66a22d9d","line":110,"updated":"2017-03-24 11:31:35.000000000","message":"here we choose whatever builder attrs we think may be useful to have in the composite metadata, in addition to fixed metadata\n\nThe extra attrs included here (currently None because IDK what they are yet!) can vary between different versions of same ring. So we might have an md5 and/or version here that we can use to assert \"the buider used to compose the current composite ring was in same state as this other instance of the same builder\"","commit_id":"0a3c19e75a5a3ccedc8efd1510ebc404e47ff6f0"},{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"0eb3934bcf93360a1074e6977f3fea1a3a856614","unresolved":false,"context_lines":[{"line_number":177,"context_line":"                                 (k, v, meta.get(k)))"},{"line_number":178,"context_line":""},{"line_number":179,"context_line":"    errors \u003d []"},{"line_number":180,"context_line":"    for i, existing in enumerate(existing_composite_metadata[\u0027components\u0027]):"},{"line_number":181,"context_line":"        try:"},{"line_number":182,"context_line":"            try:"},{"line_number":183,"context_line":"                builder \u003d builders[i]"}],"source_content_type":"text/x-python","patch_set":1,"id":"ffe62b97_33c8f453","line":180,"range":{"start_line":180,"start_character":33,"end_line":180,"end_character":73},"updated":"2017-03-24 10:06:00.000000000","message":"Er, the existing_composite_metadata is loaded from the already written one.","commit_id":"0a3c19e75a5a3ccedc8efd1510ebc404e47ff6f0"},{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"0eb3934bcf93360a1074e6977f3fea1a3a856614","unresolved":false,"context_lines":[{"line_number":184,"context_line":"            except IndexError:"},{"line_number":185,"context_line":"                errors.append(\"Missing builder at index %d\" % i)"},{"line_number":186,"context_line":"                continue"},{"line_number":187,"context_line":"            check_sameness(existing, builder)"},{"line_number":188,"context_line":"        except ValueError as err:"},{"line_number":189,"context_line":"            errors.append(\"Unexpected builder at index %d: \""},{"line_number":190,"context_line":"                          \"%r does not match existing %r: %s\" %"}],"source_content_type":"text/x-python","patch_set":1,"id":"ffe62b97_fa7818f9","line":187,"range":{"start_line":187,"start_character":11,"end_line":187,"end_character":45},"updated":"2017-03-24 10:06:00.000000000","message":"And check_sameness???\n\nSo that mean, the expected operation is...\n\n- we had dump a composite ring (ring.gz) once\n- no rebalance/add devs/remove devs in the component rings because md5 should be same, here\n- but we want to dump the composite ring again???\n\nIt sounds weird. If the existing_composite_metadata is sort of \"composite builder file\" instead, it seems normal operation to me.\n\nOr, perhaps, if the identifier doesn\u0027t care about the rebalance/dev list state, it may work.","commit_id":"0a3c19e75a5a3ccedc8efd1510ebc404e47ff6f0"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"9a830b9b083336679e789e9160474fd78c49c216","unresolved":false,"context_lines":[{"line_number":184,"context_line":"            except IndexError:"},{"line_number":185,"context_line":"                errors.append(\"Missing builder at index %d\" % i)"},{"line_number":186,"context_line":"                continue"},{"line_number":187,"context_line":"            check_sameness(existing, builder)"},{"line_number":188,"context_line":"        except ValueError as err:"},{"line_number":189,"context_line":"            errors.append(\"Unexpected builder at index %d: \""},{"line_number":190,"context_line":"                          \"%r does not match existing %r: %s\" %"}],"source_content_type":"text/x-python","patch_set":1,"id":"ffe62b97_46528969","line":187,"range":{"start_line":187,"start_character":11,"end_line":187,"end_character":45},"in_reply_to":"ffe62b97_fa7818f9","updated":"2017-03-24 11:31:35.000000000","message":"I need to fix this. As it is right now this deosn\u0027t make sense using the md5.\n\n\"sameness\" means same builder, but not necessarily the same version\n\nso the semantic should be:\n\n builderA before dev change/rebalance is \"same\" as builderA after dev change/rebalance\n\n  builder A is never the same as builderB","commit_id":"0a3c19e75a5a3ccedc8efd1510ebc404e47ff6f0"},{"author":{"_account_id":12261,"name":"Mahati","email":"mahati.chamarthy@gmail.com","username":"Mahati"},"change_message_id":"1b0a1c125ed3981ffc486a38885cd663b453524d","unresolved":false,"context_lines":[{"line_number":63,"context_line":"        regions_info[builder] \u003d set("},{"line_number":64,"context_line":"            [dev[\u0027region\u0027] for dev in builder._iter_devs()])"},{"line_number":65,"context_line":"    for first, second in combinations(regions_info.items(), 2):"},{"line_number":66,"context_line":"        inter \u003d first[1] \u0026 (second[1])"},{"line_number":67,"context_line":"        if inter:"},{"line_number":68,"context_line":"            # TODO: it may be useful to ragard the same region in the"},{"line_number":69,"context_line":"            #       different rings as different region. However, on that"}],"source_content_type":"text/x-python","patch_set":2,"id":"ffe62b97_9978b32a","line":66,"updated":"2017-03-27 10:16:00.000000000","message":"second[1] is already a set I believe? Why make it a tuple again for checking intersection?\n\nI\u0027m aware this was from the parent patch, but thought I\u0027d drop a comment here anyway:","commit_id":"8c93d700a11014c7c2678942eb244f3663dd673d"},{"author":{"_account_id":12261,"name":"Mahati","email":"mahati.chamarthy@gmail.com","username":"Mahati"},"change_message_id":"1b0a1c125ed3981ffc486a38885cd663b453524d","unresolved":false,"context_lines":[{"line_number":233,"context_line":"                continue"},{"line_number":234,"context_line":"            # check we have same builder in this position vs existing composite"},{"line_number":235,"context_line":"            check_same_builder(component_meta, builder)"},{"line_number":236,"context_line":"            modified \u003d modified or is_builder_modified(component_meta, builder)"},{"line_number":237,"context_line":"        except ValueError as err:"},{"line_number":238,"context_line":"            errors.append(\"Unexpected builder at index %d: \""},{"line_number":239,"context_line":"                          \"%r does not match existing %r: %s\" %"}],"source_content_type":"text/x-python","patch_set":2,"id":"ffe62b97_d9951b42","line":236,"updated":"2017-03-27 10:16:00.000000000","message":"Can \"check_same_builder\" and \"is_builder_modified\" be combined into one function? Because only if the first doesn\u0027t throw an error, we move onto check if builder is modified. \n\nOr is there a reason to not combine those, because we see extending those functions as we make progress? As of now, it seems ok to be combined.","commit_id":"8c93d700a11014c7c2678942eb244f3663dd673d"},{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"366f8648ba5597a7facad24e0b253fb2300eb54e","unresolved":false,"context_lines":[{"line_number":261,"context_line":"            errors.append(\"Problem with builder at index %d: %s\" % (i, err))"},{"line_number":262,"context_line":"    if errors:"},{"line_number":263,"context_line":"        raise ValueError(\u0027\\n\u0027.join(errors))"},{"line_number":264,"context_line":"    for builder_id, index in id2index.items():"},{"line_number":265,"context_line":"        if len(index) \u003e 1:"},{"line_number":266,"context_line":"            raise ValueError(\"Builder id %r used at indexes %s\" %"},{"line_number":267,"context_line":"                             (builder_id, \u0027, \u0027.join(index)))"},{"line_number":268,"context_line":""},{"line_number":269,"context_line":""},{"line_number":270,"context_line":"def write_composite_ring(builders, composite_ring_file):"}],"source_content_type":"text/x-python","patch_set":5,"id":"dfeb2761_c1b27e49","line":267,"range":{"start_line":264,"start_character":4,"end_line":267,"end_character":60},"updated":"2017-04-05 08:40:34.000000000","message":"OK, currently, we cannot add the builders which contain same ids. Considering safety, I like the idea that this assertion attempt to do. On the other hand, it seems like Clay has the use case affected by this restriction because he may want to make a new ring builder by copy/paste the older builder file in the file system. And remove/add devs for the new ring. Currently, we are thinking the loaded ring builder will have the uuid in the .builder file and never reasign a new uuid so the duplicate uuid can be found if the copy/pasted ring was provided here with the original ring.\n\nPerhaps, \"assign_id\" may be suitable for the arg for \"load\" method in the RingBuilder? If assign_id \u003d True (default False) specified at the load, the RingBuilder instance refuse the id in the .builder file and keep _id \u003d None. And then, the new uuid will be set at \"save\".\n\n\nMore possibility (perhaps it\u0027s crazy), something like `swift-ring-builder a.builder rebalance --force --get-newid` would work to re-assign a new uuid for the builder file? If we could employ the way, the assertion here should be kept and then, IIF the operator want to use the ring (and sure the ring is different from the original one), DO the command to create the new uuid to feed the ring to the composite ring.","commit_id":"271d5c24bdfb990e6800c45efa740a9f6cf932a1"},{"author":{"_account_id":1179,"name":"Clay Gerrard","email":"clay.gerrard@gmail.com","username":"clay-gerrard"},"change_message_id":"dd5458f62fd8c3874511837109d6b08d3d95ba12","unresolved":false,"context_lines":[{"line_number":264,"context_line":"    for builder_id, index in id2index.items():"},{"line_number":265,"context_line":"        if len(index) \u003e 1:"},{"line_number":266,"context_line":"            raise ValueError(\"Builder id %r used at indexes %s\" %"},{"line_number":267,"context_line":"                             (builder_id, \u0027, \u0027.join(index)))"},{"line_number":268,"context_line":""},{"line_number":269,"context_line":""},{"line_number":270,"context_line":"def write_composite_ring(builders, composite_ring_file):"}],"source_content_type":"text/x-python","patch_set":5,"id":"bff0334d_fb69418b","line":267,"in_reply_to":"dfeb2761_c1b27e49","updated":"2017-04-05 19:52:17.000000000","message":"no, I don\u0027t have the use-case that I would require a copy of a component ring to be in a composite twice.  It would be difficult anyway as we should restrict duplicate devices in composite rings, so by the time you get done you\u0027ve removed every device from the original ring.\n\nI did point out that I think it reasonable a copy of an on-disk builder would retain the uuid of its parent source (e.g. the swift-ring-builders \u0027backups\u0027 dir)\n\nI\u0027m not sure if there is a use-case where a copy of .builder should get re-id\u0027d but it\u0027s possible write_ring/write_builder will have the effect of a new-id - so if we leave in that work around we might be able to punt until such a use-case exists.","commit_id":"271d5c24bdfb990e6800c45efa740a9f6cf932a1"}],"test/unit/cli/test_ringbuilder.py":[{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"cfe996ccfa3595952d1d0005f40289bbfa650821","unresolved":false,"context_lines":[{"line_number":179,"context_line":"                      \u0027device\u0027: \u0027sdd4\u0027"},{"line_number":180,"context_line":"                      })"},{"line_number":181,"context_line":""},{"line_number":182,"context_line":"        def fake_assign_id():"},{"line_number":183,"context_line":"            ring._id \u003d builder_id"},{"line_number":184,"context_line":""},{"line_number":185,"context_line":"        with mock.patch.object(ring, \u0027_assign_id\u0027, fake_assign_id):"},{"line_number":186,"context_line":"            ring.save(self.tmpfile)"},{"line_number":187,"context_line":""},{"line_number":188,"context_line":"    def assertSystemExit(self, return_code, func, *argv):"},{"line_number":189,"context_line":"        with self.assertRaises(SystemExit) as cm:"}],"source_content_type":"text/x-python","patch_set":7,"id":"bff0334d_6bafd829","line":186,"range":{"start_line":182,"start_character":0,"end_line":186,"end_character":35},"updated":"2017-04-12 07:30:49.000000000","message":"Ah, got it. Related my comment at ringbuilder.py, this is the reason you want to make _assign_id as a different method. Hmm... I think\n\n with mock.patch(\u0027uuid.uuid4\u0027) as mock_uuid4_func:\n            mock_uuid4_func.return_value \u003d builder_id\n            ring.save(self.tmpfile)\n\nseems enough to us?","commit_id":"0685fb465da29a6e0fbd932a3eb1e96c6187adc0"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"0f7ceda516a139002662f124d73e03a3e4c92fe9","unresolved":false,"context_lines":[{"line_number":179,"context_line":"                      \u0027device\u0027: \u0027sdd4\u0027"},{"line_number":180,"context_line":"                      })"},{"line_number":181,"context_line":""},{"line_number":182,"context_line":"        def fake_assign_id():"},{"line_number":183,"context_line":"            ring._id \u003d builder_id"},{"line_number":184,"context_line":""},{"line_number":185,"context_line":"        with mock.patch.object(ring, \u0027_assign_id\u0027, fake_assign_id):"},{"line_number":186,"context_line":"            ring.save(self.tmpfile)"},{"line_number":187,"context_line":""},{"line_number":188,"context_line":"    def assertSystemExit(self, return_code, func, *argv):"},{"line_number":189,"context_line":"        with self.assertRaises(SystemExit) as cm:"}],"source_content_type":"text/x-python","patch_set":7,"id":"bff0334d_d070bd42","line":186,"range":{"start_line":182,"start_character":0,"end_line":186,"end_character":35},"in_reply_to":"bff0334d_6bafd829","updated":"2017-04-12 17:11:03.000000000","message":"Done\n\n_assign_id returned uuid4.hex, but thanks to your comment I have figuredout how to use mock to achieve the same.","commit_id":"0685fb465da29a6e0fbd932a3eb1e96c6187adc0"},{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"3046ab6b06e7784eaf79bc7347f702838d98c18b","unresolved":false,"context_lines":[{"line_number":179,"context_line":"                      \u0027device\u0027: \u0027sdd4\u0027"},{"line_number":180,"context_line":"                      })"},{"line_number":181,"context_line":""},{"line_number":182,"context_line":"        with mock.patch(\u0027uuid.uuid4\u0027, return_value\u003dmock.Mock(hex\u003dbuilder_id)):"},{"line_number":183,"context_line":"            ring.save(self.tmpfile)"},{"line_number":184,"context_line":""},{"line_number":185,"context_line":"    def assertSystemExit(self, return_code, func, *argv):"}],"source_content_type":"text/x-python","patch_set":8,"id":"9ff52f3f_4874ee99","line":182,"range":{"start_line":182,"start_character":23,"end_line":182,"end_character":77},"updated":"2017-04-13 05:13:30.000000000","message":"nice","commit_id":"4ea365666a9f3ce38738150845dd5e36417d7656"}],"test/unit/common/ring/test_builder.py":[{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"366f8648ba5597a7facad24e0b253fb2300eb54e","unresolved":false,"context_lines":[{"line_number":2095,"context_line":"        self.assertIs(True, loaded_rb.assign_id())"},{"line_number":2096,"context_line":"        assigned_id \u003d loaded_rb.id"},{"line_number":2097,"context_line":"        self.assertIs(False, loaded_rb.assign_id())"},{"line_number":2098,"context_line":"        self.assertEqual(assigned_id, loaded_rb.id)"},{"line_number":2099,"context_line":""},{"line_number":2100,"context_line":"    def test_search_devs(self):"},{"line_number":2101,"context_line":"        rb \u003d ring.RingBuilder(8, 3, 1)"}],"source_content_type":"text/x-python","patch_set":5,"id":"dfeb2761_a12c1a02","line":2098,"updated":"2017-04-05 08:40:34.000000000","message":"I think those new tests will be changed because the timing to assign the id will be changed.","commit_id":"271d5c24bdfb990e6800c45efa740a9f6cf932a1"}],"test/unit/common/ring/test_composite_builder.py":[{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"366f8648ba5597a7facad24e0b253fb2300eb54e","unresolved":false,"context_lines":[{"line_number":344,"context_line":"        modified_devs \u003d [dev for dev in got_ring.devs if dev]"},{"line_number":345,"context_line":"        self.assertEqual(len(orig_devs) - 1, len(modified_devs))"},{"line_number":346,"context_line":""},{"line_number":347,"context_line":"        # it\u0027s ok to have the builder files renamed"},{"line_number":348,"context_line":"        self.remove_dev_and_rebalance(builders[0])"},{"line_number":349,"context_line":"        renamed_builders \u003d []"},{"line_number":350,"context_line":"        for i, builder in enumerate(builders):"}],"source_content_type":"text/x-python","patch_set":5,"id":"dfeb2761_4110aea8","line":347,"updated":"2017-04-05 08:40:34.000000000","message":"Nice.","commit_id":"271d5c24bdfb990e6800c45efa740a9f6cf932a1"},{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"366f8648ba5597a7facad24e0b253fb2300eb54e","unresolved":false,"context_lines":[{"line_number":345,"context_line":"        self.assertEqual(len(orig_devs) - 1, len(modified_devs))"},{"line_number":346,"context_line":""},{"line_number":347,"context_line":"        # it\u0027s ok to have the builder files renamed"},{"line_number":348,"context_line":"        self.remove_dev_and_rebalance(builders[0])"},{"line_number":349,"context_line":"        renamed_builders \u003d []"},{"line_number":350,"context_line":"        for i, builder in enumerate(builders):"},{"line_number":351,"context_line":"            new_file \u003d os.path.join(self.tmpdir, \u0027renamed_%d.builder\u0027 % i)"}],"source_content_type":"text/x-python","patch_set":5,"id":"dfeb2761_7ca119f8","line":348,"updated":"2017-04-05 08:40:34.000000000","message":"Ah, ok. This is needed to change the state.\n\nI\u0027m wondering if we could have sort of `force_rebalance`, to be more explicit and robust. Currently it\u0027s not a big problem but the dev could be lack to remove?","commit_id":"271d5c24bdfb990e6800c45efa740a9f6cf932a1"},{"author":{"_account_id":4608,"name":"Kota Tsuyuzaki","email":"bloodeagle40234@gmail.com","username":"tsuyuzaki-kota"},"change_message_id":"366f8648ba5597a7facad24e0b253fb2300eb54e","unresolved":false,"context_lines":[{"line_number":376,"context_line":"        check_missing_id(builders)  # with existing ring"},{"line_number":377,"context_line":""},{"line_number":378,"context_line":"        builders \u003d self.create_sample_ringbuilders(3)"},{"line_number":379,"context_line":"        builders[2]._id \u003d builders[0]._id"},{"line_number":380,"context_line":"        with self.assertRaises(ValueError) as cm:"},{"line_number":381,"context_line":"            write_composite_ring(builders, self.output_ring)"},{"line_number":382,"context_line":"        error_lines \u003d cm.exception.message.split(\u0027\\n\u0027)"}],"source_content_type":"text/x-python","patch_set":5,"id":"dfeb2761_5c25355b","line":379,"updated":"2017-04-05 08:40:34.000000000","message":"I\u0027d split this test case which asserts NOT missing case BUT duplicate case because it\u0027s inconsistent with the test name.","commit_id":"271d5c24bdfb990e6800c45efa740a9f6cf932a1"}]}
