)]}'
{"networking_ovn/common/config.py":[{"author":{"_account_id":23458,"name":"Dong Jun","email":"dongjun.01@bytedance.com","username":"Dongj"},"change_message_id":"f0553d03fc7eaebbd2acb6fab4b03bcf3dd440f6","unresolved":false,"context_lines":[{"line_number":145,"context_line":"]"},{"line_number":146,"context_line":""},{"line_number":147,"context_line":"cfg.CONF.register_opts(ovn_opts, group\u003d\u0027ovn\u0027)"},{"line_number":148,"context_line":"cfg.CONF.register_opts(ovn_journal_opts, group\u003d\u0027journal\u0027)"},{"line_number":149,"context_line":""},{"line_number":150,"context_line":""},{"line_number":151,"context_line":"def list_opts():"}],"source_content_type":"text/x-python","patch_set":10,"id":"ff0f0b1f_cb49e032","line":148,"range":{"start_line":148,"start_character":47,"end_line":148,"end_character":56},"updated":"2017-05-27 12:37:16.000000000","message":"I suggest change group name to ovn_journal.","commit_id":"8e33fc45e1e1be0c5f027efce135ec2769bab26e"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"5408b2d4b0b0371a049d34ef6a7cf490359fe07e","unresolved":false,"context_lines":[{"line_number":145,"context_line":"]"},{"line_number":146,"context_line":""},{"line_number":147,"context_line":"cfg.CONF.register_opts(ovn_opts, group\u003d\u0027ovn\u0027)"},{"line_number":148,"context_line":"cfg.CONF.register_opts(ovn_journal_opts, group\u003d\u0027journal\u0027)"},{"line_number":149,"context_line":""},{"line_number":150,"context_line":""},{"line_number":151,"context_line":"def list_opts():"}],"source_content_type":"text/x-python","patch_set":10,"id":"df140735_4c516d36","line":148,"range":{"start_line":148,"start_character":47,"end_line":148,"end_character":56},"in_reply_to":"ff0f0b1f_cb49e032","updated":"2017-05-30 15:34:20.000000000","message":"Thanks for the suggestion, I will change it.","commit_id":"8e33fc45e1e1be0c5f027efce135ec2769bab26e"}],"networking_ovn/journal/validations.py":[{"author":{"_account_id":23458,"name":"Dong Jun","email":"dongjun.01@bytedance.com","username":"Dongj"},"change_message_id":"f0553d03fc7eaebbd2acb6fab4b03bcf3dd440f6","unresolved":false,"context_lines":[{"line_number":71,"context_line":"    if not isinstance(object_id, (list, tuple)):"},{"line_number":72,"context_line":"        object_id \u003d (object_id,)"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    for object_id in object_id:"},{"line_number":75,"context_line":"        if db.check_for_pending_or_processing_ops("},{"line_number":76,"context_line":"                session, object_id, seqnum\u003dentry.seqnum):"},{"line_number":77,"context_line":"            return False"}],"source_content_type":"text/x-python","patch_set":10,"id":"df140735_39f22f08","line":74,"range":{"start_line":74,"start_character":8,"end_line":74,"end_character":17},"updated":"2017-05-27 12:37:16.000000000","message":"Better to rename this object_id to another name, it\u0027s easy to understand.","commit_id":"8e33fc45e1e1be0c5f027efce135ec2769bab26e"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"5408b2d4b0b0371a049d34ef6a7cf490359fe07e","unresolved":false,"context_lines":[{"line_number":71,"context_line":"    if not isinstance(object_id, (list, tuple)):"},{"line_number":72,"context_line":"        object_id \u003d (object_id,)"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    for object_id in object_id:"},{"line_number":75,"context_line":"        if db.check_for_pending_or_processing_ops("},{"line_number":76,"context_line":"                session, object_id, seqnum\u003dentry.seqnum):"},{"line_number":77,"context_line":"            return False"}],"source_content_type":"text/x-python","patch_set":10,"id":"df140735_ec5f213f","line":74,"range":{"start_line":74,"start_character":8,"end_line":74,"end_character":17},"in_reply_to":"df140735_39f22f08","updated":"2017-05-30 15:34:20.000000000","message":"ops indeed","commit_id":"8e33fc45e1e1be0c5f027efce135ec2769bab26e"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"29bcd67e7501900b54d7ba9c54d95fc0648c2323","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# Copyright 2017 Red Hat, Inc."},{"line_number":2,"context_line":"# All Rights Reserved."},{"line_number":3,"context_line":"#"},{"line_number":4,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"}],"source_content_type":"text/x-python","patch_set":14,"id":"df140735_dbfb3abb","line":1,"range":{"start_line":1,"start_character":0,"end_line":1,"end_character":30},"updated":"2017-06-06 09:11:07.000000000","message":"this seems like a copy from networking-odl.\ni don\u0027t think it\u0027s appropriate to change the copyright notice this way.\nyou should credit the original author.\n\nit\u0027s even better if you can generalize and share the code with networking-odl.","commit_id":"1d49ca3fba51a276ca8707021c4b723c6a632ca2"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"69619f2bfd4303c8061db2ba035d7643cb3ac21c","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# Copyright 2017 Red Hat, Inc."},{"line_number":2,"context_line":"# All Rights Reserved."},{"line_number":3,"context_line":"#"},{"line_number":4,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"}],"source_content_type":"text/x-python","patch_set":14,"id":"df140735_a4018207","line":1,"range":{"start_line":1,"start_character":0,"end_line":1,"end_character":30},"in_reply_to":"df140735_dbfb3abb","updated":"2017-06-06 11:07:16.000000000","message":"++ agreed! \n\nThe idea is to have most of the code shareable between both projects (and potentially other ml2 drivers that may want to use journaling too), including this file. It does have some differences between the ODL one but, I believe it can be easily adapted.\n\nRegarding the copyright notice I will add back the original one, I usually add this one automatically when I start a new file. I was most looking at function by function from ODL and copying \u0026 adapting it over to understand how it was done.","commit_id":"1d49ca3fba51a276ca8707021c4b723c6a632ca2"}],"networking_ovn/ml2/mech_driver.py":[{"author":{"_account_id":11762,"name":"Han Zhou","email":"zhouhan@gmail.com","username":"hanzhou"},"change_message_id":"749595cb8ef80ba04effa3c2cc8b9e14ce337ef5","unresolved":false,"context_lines":[{"line_number":276,"context_line":"        self._validate_network_segments(context.network_segments)"},{"line_number":277,"context_line":""},{"line_number":278,"context_line":"    @journal.wake_journal_thread_on_end"},{"line_number":279,"context_line":"    def create_network_postcommit(self, context):"},{"line_number":280,"context_line":"        \"\"\"Create a network."},{"line_number":281,"context_line":""},{"line_number":282,"context_line":"        :param context: NetworkContext instance describing the new"}],"source_content_type":"text/x-python","patch_set":19,"id":"7f231b9d_3b0e5832","line":279,"updated":"2017-06-13 06:01:43.000000000","message":"recording journal in postcommit won\u0027t help for the race condition. Instead, it should be recorded in the precommit, so the ordering in the journal will be the same as the original Neutron DB transaction.","commit_id":"8a2864108c13d83b5b5cc4c949ff92e219dc9a01"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"b646e8e15c41c955fb93e98c79f6f47e07b6f139","unresolved":false,"context_lines":[{"line_number":276,"context_line":"        self._validate_network_segments(context.network_segments)"},{"line_number":277,"context_line":""},{"line_number":278,"context_line":"    @journal.wake_journal_thread_on_end"},{"line_number":279,"context_line":"    def create_network_postcommit(self, context):"},{"line_number":280,"context_line":"        \"\"\"Create a network."},{"line_number":281,"context_line":""},{"line_number":282,"context_line":"        :param context: NetworkContext instance describing the new"}],"source_content_type":"text/x-python","patch_set":19,"id":"7f231b9d_2db4ac34","line":279,"in_reply_to":"7f231b9d_1a38089e","updated":"2017-06-14 10:02:36.000000000","message":"Hi @Han,\n\nI was skimming thru the neutron code here and seems that both precommit and postcommit should be in the same transacton ?\n\nFor example: https://github.com/openstack/neutron/blob/044a06383b635990b2a041e4f941e20309ac9ca2/neutron/plugins/ml2/plugin.py#L799-L804\n\nAnd there\u0027s a rollback, in case something fails in the postcommit() (like for us that would be to the record_in_journal) the resource is then deleted, for example: https://github.com/openstack/neutron/blob/044a06383b635990b2a041e4f941e20309ac9ca2/neutron/plugins/ml2/plugin.py#L806-L817","commit_id":"8a2864108c13d83b5b5cc4c949ff92e219dc9a01"},{"author":{"_account_id":11762,"name":"Han Zhou","email":"zhouhan@gmail.com","username":"hanzhou"},"change_message_id":"8a0a402530d79443ad6193b512b46b0d00b7aa97","unresolved":false,"context_lines":[{"line_number":276,"context_line":"        self._validate_network_segments(context.network_segments)"},{"line_number":277,"context_line":""},{"line_number":278,"context_line":"    @journal.wake_journal_thread_on_end"},{"line_number":279,"context_line":"    def create_network_postcommit(self, context):"},{"line_number":280,"context_line":"        \"\"\"Create a network."},{"line_number":281,"context_line":""},{"line_number":282,"context_line":"        :param context: NetworkContext instance describing the new"}],"source_content_type":"text/x-python","patch_set":19,"id":"7f231b9d_a311dd06","line":279,"in_reply_to":"7f231b9d_2db4ac34","updated":"2017-06-14 18:13:45.000000000","message":"Put it simply, the mechanism of ml2 is like:\n\nstep 1:\nwith db transaction:\n    update neutron db\n    call xxx_precommmit() for each ml2 driver\n    \nstep 2:\nxxx_postcommit() for each ml2 driver\n\nSo, if the record_in_journal() are called in precommit, it is within same db transaction. If anything fail there, the whole db transaction is aborted, and all changes are rolled back by the DB transaction. That is what we want. More importantly regarding this race condition bug fix, it ensures the ordering of journal in the same order as the neutron changes.\n\nRegarding your concern: \n\n\u003e the resource could get created/updated/deleted in OVN prior to being created/updated/deleted in Neutron \n\nThis won\u0027t happen because the journal thread won\u0027t see the journal record until the whole DB transaction is committed.","commit_id":"8a2864108c13d83b5b5cc4c949ff92e219dc9a01"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"6a133282f73fd366184ae39a1399241f97cb2822","unresolved":false,"context_lines":[{"line_number":276,"context_line":"        self._validate_network_segments(context.network_segments)"},{"line_number":277,"context_line":""},{"line_number":278,"context_line":"    @journal.wake_journal_thread_on_end"},{"line_number":279,"context_line":"    def create_network_postcommit(self, context):"},{"line_number":280,"context_line":"        \"\"\"Create a network."},{"line_number":281,"context_line":""},{"line_number":282,"context_line":"        :param context: NetworkContext instance describing the new"}],"source_content_type":"text/x-python","patch_set":19,"id":"7f231b9d_4f84aab1","line":279,"in_reply_to":"7f231b9d_3b0e5832","updated":"2017-06-13 08:48:49.000000000","message":"Thanks @Han! That\u0027s a really good feedback, actually one that I was hoping to get. I always wondered why other mechanism drivers were doing this at the precommit phase, and my first patches did it too but, I started getting concerned about what if something happen between pre and postcommit, e.g the request being aborted (is it possible?) so I moved it to postcommit cause then I was sure that the resource in neutron was successfully created.\n\nDo you know if anything could happen between these two phases which would cause neutron to not postcommit it ?\n\nThanks again for the feedback.","commit_id":"8a2864108c13d83b5b5cc4c949ff92e219dc9a01"},{"author":{"_account_id":11762,"name":"Han Zhou","email":"zhouhan@gmail.com","username":"hanzhou"},"change_message_id":"63f2220d1e142b6d4ba10e9529ad7901ddf520bf","unresolved":false,"context_lines":[{"line_number":276,"context_line":"        self._validate_network_segments(context.network_segments)"},{"line_number":277,"context_line":""},{"line_number":278,"context_line":"    @journal.wake_journal_thread_on_end"},{"line_number":279,"context_line":"    def create_network_postcommit(self, context):"},{"line_number":280,"context_line":"        \"\"\"Create a network."},{"line_number":281,"context_line":""},{"line_number":282,"context_line":"        :param context: NetworkContext instance describing the new"}],"source_content_type":"text/x-python","patch_set":19,"id":"7f231b9d_bfdb54eb","line":279,"in_reply_to":"7f231b9d_4f84aab1","updated":"2017-06-13 22:24:04.000000000","message":"What record_in_journal really does is db operation performed under the same neutron db transaction as part of pre-commit. So if the original change is aborted, we should expected the journal change being aborted, too :)","commit_id":"8a2864108c13d83b5b5cc4c949ff92e219dc9a01"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"d4dfb8e778244833a0513a3b6e38b88ff1ed1fcf","unresolved":false,"context_lines":[{"line_number":276,"context_line":"        self._validate_network_segments(context.network_segments)"},{"line_number":277,"context_line":""},{"line_number":278,"context_line":"    @journal.wake_journal_thread_on_end"},{"line_number":279,"context_line":"    def create_network_postcommit(self, context):"},{"line_number":280,"context_line":"        \"\"\"Create a network."},{"line_number":281,"context_line":""},{"line_number":282,"context_line":"        :param context: NetworkContext instance describing the new"}],"source_content_type":"text/x-python","patch_set":19,"id":"5f201791_98b49937","line":279,"in_reply_to":"7f231b9d_a311dd06","updated":"2017-06-20 13:33:34.000000000","message":"Han thanks for your input here, again!\n\nI have changed it to precommit() in the next patch-set (#20), it still needs some work regarding unittests and journaling recovery but hopefully we will get it completed soon.","commit_id":"8a2864108c13d83b5b5cc4c949ff92e219dc9a01"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"b077be924625ddcec0452efd3a7c30bc9195ac8e","unresolved":false,"context_lines":[{"line_number":276,"context_line":"        self._validate_network_segments(context.network_segments)"},{"line_number":277,"context_line":""},{"line_number":278,"context_line":"    @journal.wake_journal_thread_on_end"},{"line_number":279,"context_line":"    def create_network_postcommit(self, context):"},{"line_number":280,"context_line":"        \"\"\"Create a network."},{"line_number":281,"context_line":""},{"line_number":282,"context_line":"        :param context: NetworkContext instance describing the new"}],"source_content_type":"text/x-python","patch_set":19,"id":"7f231b9d_1a38089e","line":279,"in_reply_to":"7f231b9d_bfdb54eb","updated":"2017-06-14 09:31:59.000000000","message":"Right, so if the record_in_journal() fails the transaction also fails ?\n\nre: aborting, I don\u0027t how the ml2 driver will get informed that the operation has been aborted (bear in mind I\u0027m not a ml2 expert). Do you have any idea of how that would work ?\n\n...\n\nThe reason why I\u0027m using the postcommit was because adding it to precommit might open a windows where the resource could get created/updated/deleted in OVN prior to being created/updated/deleted in Neutron. If the journal thread is awake and processing the journal in the moment the operation is recorded that could happen.\n\nNow, is that a real problem ? Maybe not, but, it doesn\u0027t really sound like the right thing to do IMHO. Adding it to the postcommit we are sure that the resource now already exist in neutron database and we now can go ahead and create it in OVN. Which, I think, could avoid certain races too. For example, when we create a router port it look at the subnets as well [0] so, they have to be created (as in neutron) before right ?\n\n[0] https://github.com/openstack/networking-ovn/blob/3f6da12f139a024aa9c9306a33e35b8f712bdf97/networking_ovn/common/ovn_client.py#L689 (look at that function definition)","commit_id":"8a2864108c13d83b5b5cc4c949ff92e219dc9a01"}]}
