)]}'
{"nova/db/sqlalchemy/api.py":[{"author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"change_message_id":"2a9bc8fd4489e0c47fd1442710233ef2fe430354","unresolved":false,"context_lines":[{"line_number":6443,"context_line":"    tag_ref.tag \u003d tag"},{"line_number":6444,"context_line":""},{"line_number":6445,"context_line":"    try:"},{"line_number":6446,"context_line":"        _check_instance_exists_in_project(context, instance_uuid)"},{"line_number":6447,"context_line":"        with main_context_manager.writer.independent.using(context):"},{"line_number":6448,"context_line":"            context.session.add(tag_ref)"},{"line_number":6449,"context_line":"            context.session.flush()"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba8a016a_f37a58bc","line":6446,"updated":"2015-11-19 15:43:41.000000000","message":"place a comment here: \"TODO: this should ideally be a savepoint, not independent\"","commit_id":"44fbd3d9de2a481b2411a3cee97014d3dbba93ad"},{"author":{"_account_id":10618,"name":"Pavel Kholkin","email":"p.v.holkin@mail.ru","username":"pkholkin"},"change_message_id":"71eb3746ef8c08fc43d6f43351147bd365132565","unresolved":false,"context_lines":[{"line_number":6443,"context_line":"    tag_ref.tag \u003d tag"},{"line_number":6444,"context_line":""},{"line_number":6445,"context_line":"    try:"},{"line_number":6446,"context_line":"        _check_instance_exists_in_project(context, instance_uuid)"},{"line_number":6447,"context_line":"        with main_context_manager.writer.independent.using(context):"},{"line_number":6448,"context_line":"            context.session.add(tag_ref)"},{"line_number":6449,"context_line":"            context.session.flush()"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba8a016a_94088fdb","line":6446,"in_reply_to":"ba8a016a_f37a58bc","updated":"2015-11-19 16:54:48.000000000","message":"ok, we also want to try savepoint","commit_id":"44fbd3d9de2a481b2411a3cee97014d3dbba93ad"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"ddd9028192fbb78a2608cde747b40ef952d075ac","unresolved":false,"context_lines":[{"line_number":6450,"context_line":""},{"line_number":6451,"context_line":"    try:"},{"line_number":6452,"context_line":"        _check_instance_exists_in_project(context, instance_uuid)"},{"line_number":6453,"context_line":"        with main_context_manager.writer.savepoint.using(context):"},{"line_number":6454,"context_line":"            context.session.add(tag_ref)"},{"line_number":6455,"context_line":"            context.session.flush()"},{"line_number":6456,"context_line":"    except db_exc.DBDuplicateEntry:"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a5de9d1_2160b9ce","line":6453,"updated":"2016-01-30 09:31:20.000000000","message":"Not sure I get why this one wants a savepoint, and the one below doesn\u0027t? Is that because it returns the added object, rather than does a new get query?","commit_id":"5fea7a4f432ff25415368df881719c96eb92dab0"},{"author":{"_account_id":10618,"name":"Pavel Kholkin","email":"p.v.holkin@mail.ru","username":"pkholkin"},"change_message_id":"6f39854c2afe6f988e481149ed0770e3a1658721","unresolved":false,"context_lines":[{"line_number":6450,"context_line":""},{"line_number":6451,"context_line":"    try:"},{"line_number":6452,"context_line":"        _check_instance_exists_in_project(context, instance_uuid)"},{"line_number":6453,"context_line":"        with main_context_manager.writer.savepoint.using(context):"},{"line_number":6454,"context_line":"            context.session.add(tag_ref)"},{"line_number":6455,"context_line":"            context.session.flush()"},{"line_number":6456,"context_line":"    except db_exc.DBDuplicateEntry:"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a5de9d1_34ed35b7","line":6453,"in_reply_to":"7a5de9d1_2160b9ce","updated":"2016-02-01 12:24:13.000000000","message":"Basically the session is being corrupted here with an error and it needs to have .rollback() called on it, we can\u0027t have an integrity failure in a transaction and then just continue like nothing happened, we need to use a savepoint.\n\nAlso, you can look at this test, that will fail without savepoint.\n\nhttps://github.com/openstack/nova/blob/master/nova/tests/unit/db/test_db_api.py#L9165-L9176\n\nSeems that we don\u0027t need explicit flush().","commit_id":"5fea7a4f432ff25415368df881719c96eb92dab0"},{"author":{"_account_id":10618,"name":"Pavel Kholkin","email":"p.v.holkin@mail.ru","username":"pkholkin"},"change_message_id":"bd875b7a16e7d3590cafdef339fdb68e43a90f2e","unresolved":false,"context_lines":[{"line_number":6450,"context_line":""},{"line_number":6451,"context_line":"    try:"},{"line_number":6452,"context_line":"        _check_instance_exists_in_project(context, instance_uuid)"},{"line_number":6453,"context_line":"        with main_context_manager.writer.savepoint.using(context):"},{"line_number":6454,"context_line":"            context.session.add(tag_ref)"},{"line_number":6455,"context_line":"            context.session.flush()"},{"line_number":6456,"context_line":"    except db_exc.DBDuplicateEntry:"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a5de9d1_f469ddf9","line":6453,"in_reply_to":"7a5de9d1_34ed35b7","updated":"2016-02-01 12:26:06.000000000","message":"In the method below tags are stored in set (unique) and the same exception can\u0027t happen","commit_id":"5fea7a4f432ff25415368df881719c96eb92dab0"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"46b8ce65a679d30c49e5b2fcb8747d272bbe8d17","unresolved":false,"context_lines":[{"line_number":6450,"context_line":""},{"line_number":6451,"context_line":"    try:"},{"line_number":6452,"context_line":"        _check_instance_exists_in_project(context, instance_uuid)"},{"line_number":6453,"context_line":"        with main_context_manager.writer.savepoint.using(context):"},{"line_number":6454,"context_line":"            context.session.add(tag_ref)"},{"line_number":6455,"context_line":"    except db_exc.DBDuplicateEntry:"},{"line_number":6456,"context_line":"        # NOTE(snikitin): We should ignore tags duplicates"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a5ae5dd_1e11dd52","line":6453,"updated":"2016-02-03 15:29:51.000000000","message":"Nit: I still like the idea of having a message here describing why we need the savepoint. Could be in a follow up patch.","commit_id":"a5fcaf95cbe7d90d4642c28217e721324ca8e1be"},{"author":{"_account_id":5441,"name":"Andrew Laski","email":"andrew@lascii.com","username":"alaski"},"change_message_id":"d819fb893760e0d9923242aa1ac92a18109563cb","unresolved":false,"context_lines":[{"line_number":6450,"context_line":""},{"line_number":6451,"context_line":"    try:"},{"line_number":6452,"context_line":"        _check_instance_exists_in_project(context, instance_uuid)"},{"line_number":6453,"context_line":"        with main_context_manager.writer.savepoint.using(context):"},{"line_number":6454,"context_line":"            context.session.add(tag_ref)"},{"line_number":6455,"context_line":"    except db_exc.DBDuplicateEntry:"},{"line_number":6456,"context_line":"        # NOTE(snikitin): We should ignore tags duplicates"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a5ae5dd_a8e2ca9d","line":6453,"in_reply_to":"5a5ae5dd_1e11dd52","updated":"2016-02-03 16:21:48.000000000","message":"+1","commit_id":"a5fcaf95cbe7d90d4642c28217e721324ca8e1be"}]}
