)]}'
{"doc/source/contributor/internals/quota.rst":[{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"cf888b4505bfe1d04ec971306a7213dd5642571d","unresolved":true,"context_lines":[{"line_number":135,"context_line":" * CountableResource, where resource usage is calculated every time quotas"},{"line_number":136,"context_line":"   limits are enforced by counting rows in the resource table or resources"},{"line_number":137,"context_line":"   tables and reservations"},{"line_number":138,"context_line":"   for that resource."},{"line_number":139,"context_line":" * TrackedResource, depends on the selected driver:"},{"line_number":140,"context_line":""},{"line_number":141,"context_line":"   * DbQuotaDriver: the resource usage relies on a specific table tracking"}],"source_content_type":"text/x-rst","patch_set":10,"id":"2b8a4377_1c0978ff","line":138,"range":{"start_line":138,"start_character":3,"end_line":138,"end_character":21},"updated":"2021-05-17 11:29:03.000000000","message":"nit: move to prev line","commit_id":"202f667d59e9b89fb1ce984fb06a556d0f62cc52"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"77a37df93428916419322f4cfde0769f044e0dea","unresolved":false,"context_lines":[{"line_number":135,"context_line":" * CountableResource, where resource usage is calculated every time quotas"},{"line_number":136,"context_line":"   limits are enforced by counting rows in the resource table or resources"},{"line_number":137,"context_line":"   tables and reservations"},{"line_number":138,"context_line":"   for that resource."},{"line_number":139,"context_line":" * TrackedResource, depends on the selected driver:"},{"line_number":140,"context_line":""},{"line_number":141,"context_line":"   * DbQuotaDriver: the resource usage relies on a specific table tracking"}],"source_content_type":"text/x-rst","patch_set":10,"id":"73641a41_516a1ea5","line":138,"range":{"start_line":138,"start_character":3,"end_line":138,"end_character":21},"in_reply_to":"2b8a4377_1c0978ff","updated":"2021-05-18 11:03:00.000000000","message":"Done","commit_id":"202f667d59e9b89fb1ce984fb06a556d0f62cc52"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"cf888b4505bfe1d04ec971306a7213dd5642571d","unresolved":true,"context_lines":[{"line_number":141,"context_line":"   * DbQuotaDriver: the resource usage relies on a specific table tracking"},{"line_number":142,"context_line":"     usage data, and performs explicitly counting only when the data in this"},{"line_number":143,"context_line":"     table are not in sync with actual used and reserved resources."},{"line_number":144,"context_line":"   * DbQuotaNoLockDriver: the resource usage is counted directly from the"},{"line_number":145,"context_line":"     database table asociated to the resource."},{"line_number":146,"context_line":""},{"line_number":147,"context_line":"Another difference between CountableResource and TrackedResource is that the"},{"line_number":148,"context_line":"former invokes a plugin method to count resources. CountableResource should be"}],"source_content_type":"text/x-rst","patch_set":10,"id":"e39c77e1_20539e6e","line":145,"range":{"start_line":144,"start_character":5,"end_line":145,"end_character":46},"updated":"2021-05-17 11:29:03.000000000","message":"Looks pretty similar to CountableResource, what\u0027s the difference?","commit_id":"202f667d59e9b89fb1ce984fb06a556d0f62cc52"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"cf888b4505bfe1d04ec971306a7213dd5642571d","unresolved":true,"context_lines":[{"line_number":142,"context_line":"     usage data, and performs explicitly counting only when the data in this"},{"line_number":143,"context_line":"     table are not in sync with actual used and reserved resources."},{"line_number":144,"context_line":"   * DbQuotaNoLockDriver: the resource usage is counted directly from the"},{"line_number":145,"context_line":"     database table asociated to the resource."},{"line_number":146,"context_line":""},{"line_number":147,"context_line":"Another difference between CountableResource and TrackedResource is that the"},{"line_number":148,"context_line":"former invokes a plugin method to count resources. CountableResource should be"}],"source_content_type":"text/x-rst","patch_set":10,"id":"6fe8c67b_667dc309","line":145,"range":{"start_line":145,"start_character":20,"end_line":145,"end_character":29},"updated":"2021-05-17 11:29:03.000000000","message":"associated","commit_id":"202f667d59e9b89fb1ce984fb06a556d0f62cc52"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"77a37df93428916419322f4cfde0769f044e0dea","unresolved":false,"context_lines":[{"line_number":142,"context_line":"     usage data, and performs explicitly counting only when the data in this"},{"line_number":143,"context_line":"     table are not in sync with actual used and reserved resources."},{"line_number":144,"context_line":"   * DbQuotaNoLockDriver: the resource usage is counted directly from the"},{"line_number":145,"context_line":"     database table asociated to the resource."},{"line_number":146,"context_line":""},{"line_number":147,"context_line":"Another difference between CountableResource and TrackedResource is that the"},{"line_number":148,"context_line":"former invokes a plugin method to count resources. CountableResource should be"}],"source_content_type":"text/x-rst","patch_set":10,"id":"0360a442_a822505f","line":145,"range":{"start_line":145,"start_character":20,"end_line":145,"end_character":29},"in_reply_to":"6fe8c67b_667dc309","updated":"2021-05-18 11:03:00.000000000","message":"Done","commit_id":"202f667d59e9b89fb1ce984fb06a556d0f62cc52"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"77a37df93428916419322f4cfde0769f044e0dea","unresolved":false,"context_lines":[{"line_number":141,"context_line":"   * DbQuotaDriver: the resource usage relies on a specific table tracking"},{"line_number":142,"context_line":"     usage data, and performs explicitly counting only when the data in this"},{"line_number":143,"context_line":"     table are not in sync with actual used and reserved resources."},{"line_number":144,"context_line":"   * DbQuotaNoLockDriver: the resource usage is counted directly from the"},{"line_number":145,"context_line":"     database table asociated to the resource."},{"line_number":146,"context_line":""},{"line_number":147,"context_line":"Another difference between CountableResource and TrackedResource is that the"},{"line_number":148,"context_line":"former invokes a plugin method to count resources. CountableResource should be"}],"source_content_type":"text/x-rst","patch_set":10,"id":"5b2004b5_d2748c42","line":145,"range":{"start_line":144,"start_character":5,"end_line":145,"end_character":46},"in_reply_to":"e39c77e1_20539e6e","updated":"2021-05-18 11:03:00.000000000","message":"You are right, both are pretty similar in the new driver. A \"TrackedResource\" depends only on one DB table and its distinguished because of the db_model passed in the initialization.\n\nIt is explained in the next paragraph: \"CountableResource should be therefore employed for plugins which do not leverage the Neutron database.\"","commit_id":"202f667d59e9b89fb1ce984fb06a556d0f62cc52"}],"neutron/api/extensions.py":[{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"cf888b4505bfe1d04ec971306a7213dd5642571d","unresolved":true,"context_lines":[{"line_number":463,"context_line":"                            {\u0027f\u0027: f, \u0027exception\u0027: exception})"},{"line_number":464,"context_line":""},{"line_number":465,"context_line":"    def add_extension(self, ext):"},{"line_number":466,"context_line":"        alias \u003d ext.get_alias()"},{"line_number":467,"context_line":"        # Do nothing if the extension doesn\u0027t check out"},{"line_number":468,"context_line":"        if not self._check_extension(ext):"},{"line_number":469,"context_line":"            return"}],"source_content_type":"text/x-python","patch_set":10,"id":"d1ba8478_3b631ad3","line":466,"range":{"start_line":466,"start_character":8,"end_line":466,"end_character":31},"updated":"2021-05-17 11:29:03.000000000","message":"why? #471 is the same","commit_id":"202f667d59e9b89fb1ce984fb06a556d0f62cc52"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"77a37df93428916419322f4cfde0769f044e0dea","unresolved":true,"context_lines":[{"line_number":463,"context_line":"                            {\u0027f\u0027: f, \u0027exception\u0027: exception})"},{"line_number":464,"context_line":""},{"line_number":465,"context_line":"    def add_extension(self, ext):"},{"line_number":466,"context_line":"        alias \u003d ext.get_alias()"},{"line_number":467,"context_line":"        # Do nothing if the extension doesn\u0027t check out"},{"line_number":468,"context_line":"        if not self._check_extension(ext):"},{"line_number":469,"context_line":"            return"}],"source_content_type":"text/x-python","patch_set":10,"id":"87f72954_b76f3dd2","line":466,"range":{"start_line":466,"start_character":8,"end_line":466,"end_character":31},"in_reply_to":"d1ba8478_3b631ad3","updated":"2021-05-18 11:03:00.000000000","message":"This must be some kind of leftover... I\u0027ll delete it.","commit_id":"202f667d59e9b89fb1ce984fb06a556d0f62cc52"}],"neutron/db/quota/driver_nolock.py":[{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"4932c99c5f986737fb45ddb8b850964fdd371548","unresolved":true,"context_lines":[{"line_number":28,"context_line":"    \"\"\"Driver to enforce quotas and retrieve quota information"},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"    This driver does not use a (resource, project_id) lock but relays on the"},{"line_number":31,"context_line":"    DB backend transaction isolation to performe the resource count and, if"},{"line_number":32,"context_line":"    available, create a new reservation."},{"line_number":33,"context_line":"    \"\"\""},{"line_number":34,"context_line":"    @db_api.retry_if_session_inactive()"}],"source_content_type":"text/x-python","patch_set":10,"id":"b1a58fe5_814bc2ee","line":31,"range":{"start_line":31,"start_character":4,"end_line":31,"end_character":36},"updated":"2021-05-17 11:38:39.000000000","message":"Does this driver imply REPEATABLE_READ isolation level?","commit_id":"202f667d59e9b89fb1ce984fb06a556d0f62cc52"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"cf888b4505bfe1d04ec971306a7213dd5642571d","unresolved":true,"context_lines":[{"line_number":28,"context_line":"    \"\"\"Driver to enforce quotas and retrieve quota information"},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"    This driver does not use a (resource, project_id) lock but relays on the"},{"line_number":31,"context_line":"    DB backend transaction isolation to performe the resource count and, if"},{"line_number":32,"context_line":"    available, create a new reservation."},{"line_number":33,"context_line":"    \"\"\""},{"line_number":34,"context_line":"    @db_api.retry_if_session_inactive()"}],"source_content_type":"text/x-python","patch_set":10,"id":"d23852b8_2b1957f8","line":31,"range":{"start_line":31,"start_character":40,"end_line":31,"end_character":48},"updated":"2021-05-17 11:29:03.000000000","message":"perform","commit_id":"202f667d59e9b89fb1ce984fb06a556d0f62cc52"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"77a37df93428916419322f4cfde0769f044e0dea","unresolved":true,"context_lines":[{"line_number":28,"context_line":"    \"\"\"Driver to enforce quotas and retrieve quota information"},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"    This driver does not use a (resource, project_id) lock but relays on the"},{"line_number":31,"context_line":"    DB backend transaction isolation to performe the resource count and, if"},{"line_number":32,"context_line":"    available, create a new reservation."},{"line_number":33,"context_line":"    \"\"\""},{"line_number":34,"context_line":"    @db_api.retry_if_session_inactive()"}],"source_content_type":"text/x-python","patch_set":10,"id":"edfa4174_6705ee67","line":31,"range":{"start_line":31,"start_character":4,"end_line":31,"end_character":36},"in_reply_to":"b1a58fe5_814bc2ee","updated":"2021-05-18 11:03:00.000000000","message":"No, this level of isolation is not needed. Just read committed isolation. The goal here is to calculate over a snapshot of (1) the resource table and (2) the reservations table. The sum of resources and reservations is the total number of used resources at this moment.\n\nWith read committed isolation, if two transactions are being executed, the second one can find double counted or missing rows [1]. That could lead to a quota overcommitment but that could also happen with the other driver.\n\nI\u0027ll remove this comment because is not strictly true. This reservation method relies on the operation simplicity and speed, that reduces the concurrency with other transactions.\n\n[1]https://sqlperformance.com/2014/04/t-sql-queries/the-read-committed-isolation-level","commit_id":"202f667d59e9b89fb1ce984fb06a556d0f62cc52"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"77a37df93428916419322f4cfde0769f044e0dea","unresolved":false,"context_lines":[{"line_number":28,"context_line":"    \"\"\"Driver to enforce quotas and retrieve quota information"},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"    This driver does not use a (resource, project_id) lock but relays on the"},{"line_number":31,"context_line":"    DB backend transaction isolation to performe the resource count and, if"},{"line_number":32,"context_line":"    available, create a new reservation."},{"line_number":33,"context_line":"    \"\"\""},{"line_number":34,"context_line":"    @db_api.retry_if_session_inactive()"}],"source_content_type":"text/x-python","patch_set":10,"id":"54cccfba_169d15df","line":31,"range":{"start_line":31,"start_character":40,"end_line":31,"end_character":48},"in_reply_to":"d23852b8_2b1957f8","updated":"2021-05-18 11:03:00.000000000","message":"Done","commit_id":"202f667d59e9b89fb1ce984fb06a556d0f62cc52"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"cf888b4505bfe1d04ec971306a7213dd5642571d","unresolved":true,"context_lines":[{"line_number":66,"context_line":"            return quota_api.create_reservation(context, project_id, deltas)"},{"line_number":67,"context_line":""},{"line_number":68,"context_line":"    def commit_reservation(self, context, reservation_id):"},{"line_number":69,"context_line":"        quota_api.remove_reservation(context, reservation_id, set_dirty\u003dFalse)"},{"line_number":70,"context_line":""},{"line_number":71,"context_line":"    def cancel_reservation(self, context, reservation_id):"},{"line_number":72,"context_line":"        self.commit_reservation(context, reservation_id)"}],"source_content_type":"text/x-python","patch_set":10,"id":"7f133f6b_e55ac21c","line":69,"range":{"start_line":69,"start_character":8,"end_line":69,"end_character":78},"updated":"2021-05-17 11:29:03.000000000","message":"swap #69 \u003c-\u003e #72 ?","commit_id":"202f667d59e9b89fb1ce984fb06a556d0f62cc52"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"77a37df93428916419322f4cfde0769f044e0dea","unresolved":true,"context_lines":[{"line_number":66,"context_line":"            return quota_api.create_reservation(context, project_id, deltas)"},{"line_number":67,"context_line":""},{"line_number":68,"context_line":"    def commit_reservation(self, context, reservation_id):"},{"line_number":69,"context_line":"        quota_api.remove_reservation(context, reservation_id, set_dirty\u003dFalse)"},{"line_number":70,"context_line":""},{"line_number":71,"context_line":"    def cancel_reservation(self, context, reservation_id):"},{"line_number":72,"context_line":"        self.commit_reservation(context, reservation_id)"}],"source_content_type":"text/x-python","patch_set":10,"id":"34c824d4_569fe965","line":69,"range":{"start_line":69,"start_character":8,"end_line":69,"end_character":78},"in_reply_to":"7f133f6b_e55ac21c","updated":"2021-05-18 11:03:00.000000000","message":"That\u0027s the same. \"remove_reservation\" is called from \"commit_reservation\" and \"cancel_reservation\" in the other driver too.\n\nActually, because \"commit_reservation\" is the same in \"DbQuotaDriver\", I\u0027ll remove it.","commit_id":"202f667d59e9b89fb1ce984fb06a556d0f62cc52"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"80d74e22e2a5c76814a6d7da948682377ba3602a","unresolved":true,"context_lines":[{"line_number":48,"context_line":"            limits \u003d self.get_tenant_quotas(context, resources, project_id)"},{"line_number":49,"context_line":"            unlimited_resources \u003d set([resource for (resource, limit) in"},{"line_number":50,"context_line":"                                       limits.items() if limit \u003c 0])"},{"line_number":51,"context_line":"            requested_resources \u003d (set(deltas.keys()) - unlimited_resources)"},{"line_number":52,"context_line":""},{"line_number":53,"context_line":"            # Delete expired reservations before counting valid ones. This"},{"line_number":54,"context_line":"            # operation is fast and by calling it before making any"}],"source_content_type":"text/x-python","patch_set":12,"id":"9275675d_d8d62a2c","line":51,"range":{"start_line":51,"start_character":34,"end_line":51,"end_character":35},"updated":"2021-05-24 19:53:41.000000000","message":"nitty nit: this isn\u0027t needed","commit_id":"e135a8221dba3beac4047ca9351bdfe600fcf01a"}],"neutron/quota/resource.py":[{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"cf888b4505bfe1d04ec971306a7213dd5642571d","unresolved":true,"context_lines":[{"line_number":373,"context_line":"        listen(se.Session, \u0027after_bulk_delete\u0027, self._except_bulk_delete)"},{"line_number":374,"context_line":""},{"line_number":375,"context_line":"    def unregister_events(self):"},{"line_number":376,"context_line":"        if not self._track_resource_events:"},{"line_number":377,"context_line":"            return"},{"line_number":378,"context_line":"        try:"},{"line_number":379,"context_line":"            db_api.sqla_remove(self._model_class, \u0027after_insert\u0027,"},{"line_number":380,"context_line":"                               self._db_event_handler)"}],"source_content_type":"text/x-python","patch_set":10,"id":"113f3e9a_5d045133","line":377,"range":{"start_line":376,"start_character":8,"end_line":377,"end_character":18},"updated":"2021-05-17 11:29:03.000000000","message":"Please clarify what stops us from using CountableResource with new no-lock driver? Looking at class descriptions and all this \"if not self._track_resource_events: return\"s it feels CountableResource fits better.","commit_id":"202f667d59e9b89fb1ce984fb06a556d0f62cc52"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"77a37df93428916419322f4cfde0769f044e0dea","unresolved":true,"context_lines":[{"line_number":373,"context_line":"        listen(se.Session, \u0027after_bulk_delete\u0027, self._except_bulk_delete)"},{"line_number":374,"context_line":""},{"line_number":375,"context_line":"    def unregister_events(self):"},{"line_number":376,"context_line":"        if not self._track_resource_events:"},{"line_number":377,"context_line":"            return"},{"line_number":378,"context_line":"        try:"},{"line_number":379,"context_line":"            db_api.sqla_remove(self._model_class, \u0027after_insert\u0027,"},{"line_number":380,"context_line":"                               self._db_event_handler)"}],"source_content_type":"text/x-python","patch_set":10,"id":"c48b52e5_9bab7d2f","line":377,"range":{"start_line":376,"start_character":8,"end_line":377,"end_character":18},"in_reply_to":"113f3e9a_5d045133","updated":"2021-05-18 11:03:00.000000000","message":"\"CountableResource\" relies on a method to count the resources. \"TrackedResource\" relies on a DB model, on a resource table. To count the resources we query this table filtering by project_id.\n\nOf course both are very similar but this difference is remarkable. I\u0027m keeping this class because I want both drivers to be selectable and \"TrackedResource\" is used in many places of the Neutron code.\n\nIf, in a future, we decide to remove the old driver, we can refactor the Quota system, the classes and clean-up the quota API (we don\u0027t need the concept of \"dirty\" anymore).","commit_id":"202f667d59e9b89fb1ce984fb06a556d0f62cc52"}]}
