)]}'
{"specs/newton/approved/glance/add-distinction-layer.rst":[{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"7deb124a288e850218b2f67747f11bb4ca570f64","unresolved":false,"context_lines":[{"line_number":26,"context_line":"lead to serious problems, such as loss of information and unstable behaviour."},{"line_number":27,"context_line":"A more detailed description of the problems can be found on"},{"line_number":28,"context_line":"references [7]_ and [8]_."},{"line_number":29,"context_line":""},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"Proposed change"},{"line_number":32,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"}],"source_content_type":"text/x-rst","patch_set":9,"id":"7aa08908_32ecd628","line":29,"updated":"2016-06-11 16:56:08.000000000","message":"I\u0027d suggest adding some more here:\n\n  Briefly, the problems are:\n\n  The race condition: Suppose an image has properties \"foo\":\"bar\", \"goo\":\"far\".  User1 wants to change \"foo\":\"baz\", while user2 wants to change \"goo\":\"yuck\".  If user1 and user2 make concurrent requests, they both get the same data to work with.  Suppose user1\u0027s change gets written first, resulting in: \"foo\":\"baz\", \"goo\":\"far\".  Then user2\u0027s change is written, resulting in: \"foo\":\"bar\", \"goo\":\"yuck\".  User1\u0027s change has been reverted, which is not desired behavior.\n\n  The database load problem: all image fields are being updated each time whether they\u0027ve been modified or not, so there is lots of unnecessary traffic on the database.","commit_id":"fa708ef6c854bc00b4d1772356777a159717de89"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"7deb124a288e850218b2f67747f11bb4ca570f64","unresolved":false,"context_lines":[{"line_number":35,"context_line":"layer. Then, if image is saving in db, distinction layer creates dict"},{"line_number":36,"context_line":"representation of modified image and compares it with the original one."},{"line_number":37,"context_line":"Then it passes to DB layer only modified attributes."},{"line_number":38,"context_line":""},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"Alternatives"},{"line_number":41,"context_line":"------------"}],"source_content_type":"text/x-rst","patch_set":9,"id":"7aa08908_12bf1afc","line":38,"updated":"2016-06-11 16:56:08.000000000","message":"I\u0027d suggest changing the above paragraph to:\n\n  When a change is requested, the image is retrieved from the database and stored as a dict in a distinction layer.  Only the differences between the record in the distinction layer and the image as modified in the request will be written to the database.\n\nAnd then add some more:\n\n  Continuing the example from the previous section, consider the situation after user1\u0027s update has been processed and \"foo\":\"baz\" in the database.  User2\u0027s distinction layer image record contains \"foo\":\"bar\", since that was the state of the image when the fetch occurred.  However, since user2\u0027s change request doesn\u0027t touch \"foo\", only \"goo\":\"yuck\" will be written to the database.  Thus the final image record will have \"foo\":\"baz\", \"goo\":\"yuck\" as both users intend.\n\n  Of course, if user2 does actually change the value of \"foo\", then user2\u0027s change will be persisted in the database, but this is expected behavior.","commit_id":"fa708ef6c854bc00b4d1772356777a159717de89"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"7deb124a288e850218b2f67747f11bb4ca570f64","unresolved":false,"context_lines":[{"line_number":42,"context_line":""},{"line_number":43,"context_line":"There have been attempts to solve the problem using inheritance."},{"line_number":44,"context_line":"References on commits [1]_, [2]_. But commits were abandoned, because"},{"line_number":45,"context_line":"inheritance is contrary to the main idea of using design pattern."},{"line_number":46,"context_line":""},{"line_number":47,"context_line":"Alternatively, it was suggested to forbid updates while an image is in"},{"line_number":48,"context_line":"\"saving\" state. But this idea was rejected, because it fixes only a special"}],"source_content_type":"text/x-rst","patch_set":9,"id":"7aa08908_472602bb","line":45,"range":{"start_line":45,"start_character":27,"end_line":45,"end_character":64},"updated":"2016-06-11 16:56:08.000000000","message":"Maybe replace this with:\n\nthe Glance design strategy of favoring flat hierarchies and preferring aggregation over inheritance.","commit_id":"fa708ef6c854bc00b4d1772356777a159717de89"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"7deb124a288e850218b2f67747f11bb4ca570f64","unresolved":false,"context_lines":[{"line_number":47,"context_line":"Alternatively, it was suggested to forbid updates while an image is in"},{"line_number":48,"context_line":"\"saving\" state. But this idea was rejected, because it fixes only a special"},{"line_number":49,"context_line":"case, when status is \u0027saving\u0027, but the whole problem with race conditions and"},{"line_number":50,"context_line":"unreasonably increased load on the database is still here."},{"line_number":51,"context_line":""},{"line_number":52,"context_line":"Data model impact"},{"line_number":53,"context_line":"-----------------"}],"source_content_type":"text/x-rst","patch_set":9,"id":"7aa08908_8712aa60","line":50,"updated":"2016-06-11 16:56:08.000000000","message":"I think it\u0027s also worth pointing out the user experience problem with this suggestion, namely, that images tend to be in status \u0027saving\u0027 for a relatively long period, and users expect to be able to modify the image record during this time.  (But I don\u0027t insist on this change.)","commit_id":"fa708ef6c854bc00b4d1772356777a159717de89"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"97aa56ed3e7b638c26ae7e28302a8de1d66c4496","unresolved":false,"context_lines":[{"line_number":48,"context_line":"Proposed change"},{"line_number":49,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"When image is fetched from db its dict representation is stored on distinction"},{"line_number":52,"context_line":"layer. Then, if image is saving in db, distinction layer creates dict"},{"line_number":53,"context_line":"representation of modified image and compares it with the original one."},{"line_number":54,"context_line":"Then it passes to DB layer only modified attributes."},{"line_number":55,"context_line":""},{"line_number":56,"context_line":"When a change is requested, the image is retrieved from the database and"},{"line_number":57,"context_line":"stored as a dict in a distinction layer.  Only the differences between the"}],"source_content_type":"text/x-rst","patch_set":10,"id":"7aa08908_12ec9391","line":54,"range":{"start_line":51,"start_character":0,"end_line":54,"end_character":52},"updated":"2016-06-15 15:53:51.000000000","message":"This paragraph and the next one seem to be saying roughly the same thing.  Could you smooth out any differences between the two so we\u0027d have one accurate paragraph here?","commit_id":"6e841d8dab1ecb77a8944faee9c20d49121377a5"}],"specs/newton/approved/glance/add-transaction-layer.rst":[{"author":{"_account_id":11391,"name":"Mikhail Fedosin","email":"mfedosin@redhat.com","username":"fedosinme"},"change_message_id":"799b5e59de221179c22af4362a9e0764826d6a10","unresolved":false,"context_lines":[{"line_number":18,"context_line":"Problem description"},{"line_number":19,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"Current Glance Images v2 and Artifact architectures have a defect associated"},{"line_number":22,"context_line":"with risks of race conditions arising under heavy load on the system. Besides"},{"line_number":23,"context_line":"this, there is an issue of unreasonably increased load on the database when"},{"line_number":24,"context_line":"updating, and also an issue with changing the status of the image. These"}],"source_content_type":"text/x-rst","patch_set":1,"id":"dab17558_04161b55","line":21,"range":{"start_line":21,"start_character":29,"end_line":21,"end_character":37},"updated":"2016-05-12 11:27:46.000000000","message":"What do you mean by Artifact? We don\u0027t use domain in Glare v1.","commit_id":"5290c67c8ffce4c2f4b5a1a30cf0a317f512b9fd"},{"author":{"_account_id":11391,"name":"Mikhail Fedosin","email":"mfedosin@redhat.com","username":"fedosinme"},"change_message_id":"799b5e59de221179c22af4362a9e0764826d6a10","unresolved":false,"context_lines":[{"line_number":30,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"I propose adding transaction layer, which will store all changes of the"},{"line_number":33,"context_line":"object and pass to DB only modified attributes"},{"line_number":34,"context_line":""},{"line_number":35,"context_line":""},{"line_number":36,"context_line":"Alternatives"}],"source_content_type":"text/x-rst","patch_set":1,"id":"dab17558_5f0bce2b","line":33,"updated":"2016-05-12 11:27:46.000000000","message":"I think we need to be more specific here. Like \"When image is fetched from db its dict representation is stored on transaction layer. Then, if image is saving in db, transaction layer creates dict representation of modified image and compares it with the original one. Then it passes to DB layer only modified attributes.\"","commit_id":"5290c67c8ffce4c2f4b5a1a30cf0a317f512b9fd"},{"author":{"_account_id":11391,"name":"Mikhail Fedosin","email":"mfedosin@redhat.com","username":"fedosinme"},"change_message_id":"799b5e59de221179c22af4362a9e0764826d6a10","unresolved":false,"context_lines":[{"line_number":38,"context_line":""},{"line_number":39,"context_line":"There have been attempts to solve the problem using inheritance."},{"line_number":40,"context_line":"References on commits [1]_, [2]_. But commits were abandoned, because"},{"line_number":41,"context_line":"inheritance is contrary to the main idea of using design pattern Decorator."},{"line_number":42,"context_line":""},{"line_number":43,"context_line":"Data model impact"},{"line_number":44,"context_line":"-----------------"}],"source_content_type":"text/x-rst","patch_set":1,"id":"dab17558_bfe0facd","line":41,"range":{"start_line":41,"start_character":65,"end_line":41,"end_character":74},"updated":"2016-05-12 11:27:46.000000000","message":"Don\u0027t mention \"decorator\" here, because it only looks like decorator, but it\u0027s not.","commit_id":"5290c67c8ffce4c2f4b5a1a30cf0a317f512b9fd"},{"author":{"_account_id":11391,"name":"Mikhail Fedosin","email":"mfedosin@redhat.com","username":"fedosinme"},"change_message_id":"799b5e59de221179c22af4362a9e0764826d6a10","unresolved":false,"context_lines":[{"line_number":68,"context_line":"Performance Impact"},{"line_number":69,"context_line":"------------------"},{"line_number":70,"context_line":""},{"line_number":71,"context_line":"None"},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"Other deployer impact"},{"line_number":74,"context_line":"---------------------"}],"source_content_type":"text/x-rst","patch_set":1,"id":"dab17558_ffcd62b8","line":71,"range":{"start_line":71,"start_character":0,"end_line":71,"end_character":4},"updated":"2016-05-12 11:27:46.000000000","message":"From my pint of view there will be performance improvement when you update images. It will be cool if you can add some stats here.","commit_id":"5290c67c8ffce4c2f4b5a1a30cf0a317f512b9fd"},{"author":{"_account_id":11391,"name":"Mikhail Fedosin","email":"mfedosin@redhat.com","username":"fedosinme"},"change_message_id":"799b5e59de221179c22af4362a9e0764826d6a10","unresolved":false,"context_lines":[{"line_number":100,"context_line":"Work Items"},{"line_number":101,"context_line":"----------"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"None"},{"line_number":104,"context_line":""},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"Dependencies"}],"source_content_type":"text/x-rst","patch_set":1,"id":"dab17558_5ff8eec4","line":103,"range":{"start_line":103,"start_character":0,"end_line":103,"end_character":4},"updated":"2016-05-12 11:27:46.000000000","message":"1. Implement transaction layer.\n2. Add related functional and unit tests.\n3. Write a documentation about this layer.","commit_id":"5290c67c8ffce4c2f4b5a1a30cf0a317f512b9fd"},{"author":{"_account_id":11391,"name":"Mikhail Fedosin","email":"mfedosin@redhat.com","username":"fedosinme"},"change_message_id":"799b5e59de221179c22af4362a9e0764826d6a10","unresolved":false,"context_lines":[{"line_number":118,"context_line":"Documentation Impact"},{"line_number":119,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"None"},{"line_number":122,"context_line":""},{"line_number":123,"context_line":""},{"line_number":124,"context_line":"References"}],"source_content_type":"text/x-rst","patch_set":1,"id":"dab17558_bfbd9ad9","line":121,"range":{"start_line":121,"start_character":0,"end_line":121,"end_character":4},"updated":"2016-05-12 11:27:46.000000000","message":"All changes have to be described in detail in the related documentation section.","commit_id":"5290c67c8ffce4c2f4b5a1a30cf0a317f512b9fd"},{"author":{"_account_id":11391,"name":"Mikhail Fedosin","email":"mfedosin@redhat.com","username":"fedosinme"},"change_message_id":"68c16a99a812f770776fe40e68f7218c7b193db5","unresolved":false,"context_lines":[{"line_number":76,"context_line":"The results are presented in [3]_:"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":"* Blue line - without transaction layer."},{"line_number":79,"context_line":"* Red line - with transaction layer."},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"Test code is presented in [4]_."},{"line_number":82,"context_line":""}],"source_content_type":"text/x-rst","patch_set":2,"id":"dab17558_50a657c1","line":79,"updated":"2016-05-17 11:54:01.000000000","message":"I think you should describe in detail what exactly you test here and add some conclusion (like \"with transaction layer updating image performance increased by 5%)","commit_id":"979d6f39b9024dec9d636fd9eaea4e201944496f"},{"author":{"_account_id":9775,"name":"Sudipta Biswas","email":"sbiswas7@in.ibm.com","username":"sudswas"},"change_message_id":"895584640ecb907e42e1bb5e1afb98ddc719aa7c","unresolved":false,"context_lines":[{"line_number":30,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"When image is fetched from db its dict representation is stored on transaction"},{"line_number":33,"context_line":"layer. Then, if image is saving in db, transaction layer creates dict"},{"line_number":34,"context_line":"representation of modified image and compares it with the original one."},{"line_number":35,"context_line":"Then it passes to DB layer only modified attributes."},{"line_number":36,"context_line":""}],"source_content_type":"text/x-rst","patch_set":3,"id":"bab6814e_a73e15b6","line":33,"updated":"2016-05-18 15:55:13.000000000","message":"Can you explain a bit more on what you mean by inheritance here? I have gone through atleast one of the old reviews where it just tried to verify the timestamps of \u0027updated_at\u0027 and decide whether another thread modified the image in between. While I somewhat understand your approach of adding the transaction layer, as a general reader of the spec, I would also like to know - how you are going to deal with the problem of concurrent updates?","commit_id":"011adedbf81e0bca9c79952e2dd0efc292991aec"},{"author":{"_account_id":16658,"name":"Darja Shakhray","email":"damalyavkina@gmail.com","username":"dshakhray"},"change_message_id":"23ea2e3e6bd87d39cd3701178c7c9756d9d35d04","unresolved":false,"context_lines":[{"line_number":30,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"When image is fetched from db its dict representation is stored on transaction"},{"line_number":33,"context_line":"layer. Then, if image is saving in db, transaction layer creates dict"},{"line_number":34,"context_line":"representation of modified image and compares it with the original one."},{"line_number":35,"context_line":"Then it passes to DB layer only modified attributes."},{"line_number":36,"context_line":""}],"source_content_type":"text/x-rst","patch_set":3,"id":"bab6814e_6f75b830","line":33,"in_reply_to":"bab6814e_a73e15b6","updated":"2016-05-20 11:34:33.000000000","message":"Hello, Sudipta! Thanks very much for review)\n\nI\u0027m sorry, I posted the wrong link to the commit by inheritance. I fixed it in a new pathset. I\u0027m talking about https://review.openstack.org/#/c/123722/ \n\"This change introduces the StateTrackingObject class which may be used as a superclass for all the domain objects. This class tracks the modifications of all the attributes in the domain objects and thus is able to filter-out the unaffected ones. This is used to update only the modified fields of the images.\"\n\nAs for the method of \"verify the timestamps of \u0027updated_at\u0027\" This method allows to determine whether the image has changed during the execution of the update operation. This method creates a small inconvenience. For example, user1 wants to change the name of the image, but at the time of the query user2 changed disk_format in the image. Because of this, Glance is not allowed to change the name on request user1. But the disk_format and the name does not depend on each other. User1 will be sad.\n\nTransaction layer solves this problem. If changes are not dependent on each other, they will be used, and no data are lost. If the user requests to change the same field, the changes will be applied one after the other.","commit_id":"011adedbf81e0bca9c79952e2dd0efc292991aec"},{"author":{"_account_id":9775,"name":"Sudipta Biswas","email":"sbiswas7@in.ibm.com","username":"sudswas"},"change_message_id":"895584640ecb907e42e1bb5e1afb98ddc719aa7c","unresolved":false,"context_lines":[{"line_number":119,"context_line":"Work Items"},{"line_number":120,"context_line":"----------"},{"line_number":121,"context_line":""},{"line_number":122,"context_line":"1. Implement transaction layer."},{"line_number":123,"context_line":"2. Add related functional and unit tests."},{"line_number":124,"context_line":"3. Write a documentation about this layer."},{"line_number":125,"context_line":""}],"source_content_type":"text/x-rst","patch_set":3,"id":"bab6814e_87a5d105","line":122,"updated":"2016-05-18 15:55:13.000000000","message":"A more detailed view of the changes might help here. Something like - where you would add this change etc.","commit_id":"011adedbf81e0bca9c79952e2dd0efc292991aec"},{"author":{"_account_id":16658,"name":"Darja Shakhray","email":"damalyavkina@gmail.com","username":"dshakhray"},"change_message_id":"23ea2e3e6bd87d39cd3701178c7c9756d9d35d04","unresolved":false,"context_lines":[{"line_number":119,"context_line":"Work Items"},{"line_number":120,"context_line":"----------"},{"line_number":121,"context_line":""},{"line_number":122,"context_line":"1. Implement transaction layer."},{"line_number":123,"context_line":"2. Add related functional and unit tests."},{"line_number":124,"context_line":"3. Write a documentation about this layer."},{"line_number":125,"context_line":""}],"source_content_type":"text/x-rst","patch_set":3,"id":"bab6814e_6fac988c","line":122,"in_reply_to":"bab6814e_87a5d105","updated":"2016-05-20 11:34:33.000000000","message":"Done","commit_id":"011adedbf81e0bca9c79952e2dd0efc292991aec"},{"author":{"_account_id":6484,"name":"Feilong Wang","email":"hustemb@gmail.com","username":"flwang"},"change_message_id":"727bbd9f53cfdc069148ee895e6b8dfbf3526d63","unresolved":false,"context_lines":[{"line_number":19,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"Current Glance Images v2 architectures have a defect associated"},{"line_number":22,"context_line":"with risks of race conditions arising under heavy load on the system. Besides"},{"line_number":23,"context_line":"this, there is an issue of unreasonably increased load on the database when"},{"line_number":24,"context_line":"updating, and also an issue with changing the status of the image. These"},{"line_number":25,"context_line":"issues do not appear at low load, but in the future, with wider use, it can"}],"source_content_type":"text/x-rst","patch_set":6,"id":"bab6814e_e7e4040e","line":22,"updated":"2016-05-26 23:49:25.000000000","message":"I saw \u0027a defect\u0027, \u0027an issue\u0027 and \u0027also an issue\u0027, but there is not details about them.","commit_id":"af465d8f4d61b06270cd3d290e47b7e0d491bea9"},{"author":{"_account_id":16658,"name":"Darja Shakhray","email":"damalyavkina@gmail.com","username":"dshakhray"},"change_message_id":"b384fd58ce76012ab487e54345f2c82a73e2fcb2","unresolved":false,"context_lines":[{"line_number":19,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"Current Glance Images v2 architectures have a defect associated"},{"line_number":22,"context_line":"with risks of race conditions arising under heavy load on the system. Besides"},{"line_number":23,"context_line":"this, there is an issue of unreasonably increased load on the database when"},{"line_number":24,"context_line":"updating, and also an issue with changing the status of the image. These"},{"line_number":25,"context_line":"issues do not appear at low load, but in the future, with wider use, it can"}],"source_content_type":"text/x-rst","patch_set":6,"id":"9abb7d3a_b568db88","line":22,"in_reply_to":"bab6814e_e7e4040e","updated":"2016-05-30 10:08:50.000000000","message":"Fei Long Wang, thanks for the comment! I added a references to the bugs that describes the details of the problems","commit_id":"af465d8f4d61b06270cd3d290e47b7e0d491bea9"},{"author":{"_account_id":9775,"name":"Sudipta Biswas","email":"sbiswas7@in.ibm.com","username":"sudswas"},"change_message_id":"285b612e0a18fbdb525628a78b7f7d828923ab74","unresolved":false,"context_lines":[{"line_number":30,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"When image is fetched from db its dict representation is stored on transaction"},{"line_number":33,"context_line":"layer. Then, if image is saving in db, transaction layer creates dict"},{"line_number":34,"context_line":"representation of modified image and compares it with the original one."},{"line_number":35,"context_line":"Then it passes to DB layer only modified attributes."},{"line_number":36,"context_line":""}],"source_content_type":"text/x-rst","patch_set":6,"id":"bab6814e_93aa8c83","line":33,"updated":"2016-05-23 06:05:46.000000000","message":"Thanks for answering the queries. It\u0027s probably a good idea to include the compare and update logic you spoke about in the previous PS here. Referring to property changes that aren\u0027t common. I am assuming your changes will not rely on the \u0027updated_at\u0027 field at all, like the previous reviews that got abandoned. In such a case, what logic gives you the guarantee of sequencing the updates? Let\u0027s say User1 wants to update field1 and at the same time, User2 also wants to update field1. They both together say \"Update\" - who\u0027s update would you consider and how do you sequence them?\n\nSorry for being a bit pesky, but I am trying to understand the logic you would use and I believe some details on that logic could be documented in the spec.","commit_id":"af465d8f4d61b06270cd3d290e47b7e0d491bea9"},{"author":{"_account_id":16658,"name":"Darja Shakhray","email":"damalyavkina@gmail.com","username":"dshakhray"},"change_message_id":"b384fd58ce76012ab487e54345f2c82a73e2fcb2","unresolved":false,"context_lines":[{"line_number":30,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"When image is fetched from db its dict representation is stored on transaction"},{"line_number":33,"context_line":"layer. Then, if image is saving in db, transaction layer creates dict"},{"line_number":34,"context_line":"representation of modified image and compares it with the original one."},{"line_number":35,"context_line":"Then it passes to DB layer only modified attributes."},{"line_number":36,"context_line":""}],"source_content_type":"text/x-rst","patch_set":6,"id":"9abb7d3a_d95dd97a","line":33,"in_reply_to":"9abb7d3a_b25ddeee","updated":"2016-05-30 10:08:50.000000000","message":"Transaction layer sends to DB layer only modified attributes. This allows you to not overwrite other attributes.\nThis all avoids data loss, and thus avoid the \"race conditions\".\n\nAs for user2, he will get the right value \"updated_at\" parameter. So he will get the expected parameters of the image, ie image + user_changes.\nGlance accesses the database before returning user data when updating the image. This allows the user to receive only valid data.","commit_id":"af465d8f4d61b06270cd3d290e47b7e0d491bea9"},{"author":{"_account_id":6484,"name":"Feilong Wang","email":"hustemb@gmail.com","username":"flwang"},"change_message_id":"727bbd9f53cfdc069148ee895e6b8dfbf3526d63","unresolved":false,"context_lines":[{"line_number":30,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"When image is fetched from db its dict representation is stored on transaction"},{"line_number":33,"context_line":"layer. Then, if image is saving in db, transaction layer creates dict"},{"line_number":34,"context_line":"representation of modified image and compares it with the original one."},{"line_number":35,"context_line":"Then it passes to DB layer only modified attributes."},{"line_number":36,"context_line":""}],"source_content_type":"text/x-rst","patch_set":6,"id":"bab6814e_27a44c49","line":33,"in_reply_to":"bab6814e_19a0e19e","updated":"2016-05-26 23:49:25.000000000","message":"I think Sudipta is also confused how this change address the race condition issue. And as for above sample, will the User A get his expected image properties and correct \u0027updated_at\u0027? So question for User 2. Thanks.","commit_id":"af465d8f4d61b06270cd3d290e47b7e0d491bea9"},{"author":{"_account_id":9775,"name":"Sudipta Biswas","email":"sbiswas7@in.ibm.com","username":"sudswas"},"change_message_id":"a142d4ccd05f547a29612ddfc8027a44fd7dcb71","unresolved":false,"context_lines":[{"line_number":30,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"When image is fetched from db its dict representation is stored on transaction"},{"line_number":33,"context_line":"layer. Then, if image is saving in db, transaction layer creates dict"},{"line_number":34,"context_line":"representation of modified image and compares it with the original one."},{"line_number":35,"context_line":"Then it passes to DB layer only modified attributes."},{"line_number":36,"context_line":""}],"source_content_type":"text/x-rst","patch_set":6,"id":"9abb7d3a_b25ddeee","line":33,"in_reply_to":"bab6814e_27a44c49","updated":"2016-05-27 04:57:36.000000000","message":"+1","commit_id":"af465d8f4d61b06270cd3d290e47b7e0d491bea9"},{"author":{"_account_id":16658,"name":"Darja Shakhray","email":"damalyavkina@gmail.com","username":"dshakhray"},"change_message_id":"d9e9fb1fb4d47d622f5353340b7698495acf4ba5","unresolved":false,"context_lines":[{"line_number":30,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"When image is fetched from db its dict representation is stored on transaction"},{"line_number":33,"context_line":"layer. Then, if image is saving in db, transaction layer creates dict"},{"line_number":34,"context_line":"representation of modified image and compares it with the original one."},{"line_number":35,"context_line":"Then it passes to DB layer only modified attributes."},{"line_number":36,"context_line":""}],"source_content_type":"text/x-rst","patch_set":6,"id":"bab6814e_19a0e19e","line":33,"in_reply_to":"bab6814e_2e7804f2","updated":"2016-05-25 14:51:10.000000000","message":"User2 will receive the correct data, ie data that is now stored in the database. Before you return the response to the user, method \u0027update\u0027 in sqlalchemy makes a GET request to the database https://github.com/openstack/glance/blob/master/glance/db/sqlalchemy/api.py#L852","commit_id":"af465d8f4d61b06270cd3d290e47b7e0d491bea9"},{"author":{"_account_id":16658,"name":"Darja Shakhray","email":"damalyavkina@gmail.com","username":"dshakhray"},"change_message_id":"f8be2c0488e594bc53993f8d0a7a88221a5965a6","unresolved":false,"context_lines":[{"line_number":30,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"When image is fetched from db its dict representation is stored on transaction"},{"line_number":33,"context_line":"layer. Then, if image is saving in db, transaction layer creates dict"},{"line_number":34,"context_line":"representation of modified image and compares it with the original one."},{"line_number":35,"context_line":"Then it passes to DB layer only modified attributes."},{"line_number":36,"context_line":""}],"source_content_type":"text/x-rst","patch_set":6,"id":"bab6814e_2e7804f2","line":33,"in_reply_to":"bab6814e_6e820c54","updated":"2016-05-25 13:13:49.000000000","message":"I don\u0027t quite understand what you mean by \"wrong data\"","commit_id":"af465d8f4d61b06270cd3d290e47b7e0d491bea9"},{"author":{"_account_id":9775,"name":"Sudipta Biswas","email":"sbiswas7@in.ibm.com","username":"sudswas"},"change_message_id":"b1f65563f83ce389addfdf3365e8fdf1afd13e72","unresolved":false,"context_lines":[{"line_number":30,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"When image is fetched from db its dict representation is stored on transaction"},{"line_number":33,"context_line":"layer. Then, if image is saving in db, transaction layer creates dict"},{"line_number":34,"context_line":"representation of modified image and compares it with the original one."},{"line_number":35,"context_line":"Then it passes to DB layer only modified attributes."},{"line_number":36,"context_line":""}],"source_content_type":"text/x-rst","patch_set":6,"id":"bab6814e_6e820c54","line":33,"in_reply_to":"bab6814e_737cb6eb","updated":"2016-05-25 13:06:42.000000000","message":"However, in such a case, the User 2\u0027s request returns back with the wrong data right?","commit_id":"af465d8f4d61b06270cd3d290e47b7e0d491bea9"},{"author":{"_account_id":16658,"name":"Darja Shakhray","email":"damalyavkina@gmail.com","username":"dshakhray"},"change_message_id":"d610c5a6161472fd7598a38c2de793b7dd1f14f1","unresolved":false,"context_lines":[{"line_number":30,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"When image is fetched from db its dict representation is stored on transaction"},{"line_number":33,"context_line":"layer. Then, if image is saving in db, transaction layer creates dict"},{"line_number":34,"context_line":"representation of modified image and compares it with the original one."},{"line_number":35,"context_line":"Then it passes to DB layer only modified attributes."},{"line_number":36,"context_line":""}],"source_content_type":"text/x-rst","patch_set":6,"id":"bab6814e_737cb6eb","line":33,"in_reply_to":"bab6814e_7898151c","updated":"2016-05-25 12:20:26.000000000","message":"You can give an example:\n\nGlance has an image with the following parameters:\n\n{field1: val_0, field2: val_0, field3: val_0, field4: val_0, field5: val_0}\n\nuser1 wants to make the following changes {field1: val_1, field2: val_2, field3: val_3}\nuser2 wants to make the following changes {field3: val_N, field4: val_4, field5: val_5}\n\nUser1\u0027s request has been processed earlier than user2\u0027s  request, then the image will be \n{field1: val_1, field2: val_2, field3: val_N, field4: val_4, field5: val_5}","commit_id":"af465d8f4d61b06270cd3d290e47b7e0d491bea9"},{"author":{"_account_id":16658,"name":"Darja Shakhray","email":"damalyavkina@gmail.com","username":"dshakhray"},"change_message_id":"96d9250fcaed239d5b7dbd603a6db6cea2788f81","unresolved":false,"context_lines":[{"line_number":30,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"When image is fetched from db its dict representation is stored on transaction"},{"line_number":33,"context_line":"layer. Then, if image is saving in db, transaction layer creates dict"},{"line_number":34,"context_line":"representation of modified image and compares it with the original one."},{"line_number":35,"context_line":"Then it passes to DB layer only modified attributes."},{"line_number":36,"context_line":""}],"source_content_type":"text/x-rst","patch_set":6,"id":"bab6814e_7898151c","line":33,"in_reply_to":"bab6814e_93aa8c83","updated":"2016-05-25 12:07:31.000000000","message":"When users want to change the same parameter field1.... For example, if request1 will be processed sooner than request2, the request2 will overwrite changes.","commit_id":"af465d8f4d61b06270cd3d290e47b7e0d491bea9"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"37f30c9b464f31058a0b8ccdbf15a6dbb3ccb803","unresolved":false,"context_lines":[{"line_number":42,"context_line":""},{"line_number":43,"context_line":"There have been attempts to solve the problem using inheritance."},{"line_number":44,"context_line":"References on commits [1]_, [2]_. But commits were abandoned, because"},{"line_number":45,"context_line":"inheritance is contrary to the main idea of using design pattern."},{"line_number":46,"context_line":""},{"line_number":47,"context_line":"Data model impact"},{"line_number":48,"context_line":"-----------------"}],"source_content_type":"text/x-rst","patch_set":7,"id":"9abb7d3a_fdf4f387","line":45,"updated":"2016-05-30 17:31:23.000000000","message":"Would an alternative just be to not allow updates while an image is in SAVING state? Just return a 409 Conflict while an image is in SAVING state for any PUT or PATCH request to the image...","commit_id":"b6f8ef60baa2df000e926c6a0eae8db5ba47106e"}]}
