[openstack-dev] [cross-project][quotas][delimiter]My thoughts on how Delimiter uses generation-id for sequencing
Amrith Kumar
amrith at tesora.com
Sun May 15 12:14:14 UTC 2016
Qijing,
I don't believe that this is correct. I promised to send a description
to the ML, I'll do that today.
-amrith
On Sun, 2016-05-15 at 01:16 -0700, Qijing Li wrote:
> Hi Vilobh,
>
> Here is my thoughts on how Delimiter uses generation-id to guarantee
> sequencing. Please correct me if I understand it wrong.
>
> First, the Delimiter need to introduce another model ResourceProvider
> who has two attributes:
>
> * resource_id
> * generation_id
>
> The followings are the steps of how to consume a quota:
>
> Step 1. Check if there is enough available quota
>
> If yes, then get the $generation_id by querying the model
> ResourceProvider with the given resource_id which is the point in time
> view of resource usage.
>
> If no, terminate the process of consuming the quota and return the
> message of “No enough quotas available."
>
> Step 2. Consume the quota.
>
> 2.1 Begin transaction
>
> 2.2 Update the QuotaUsage model: QuotaUsage.in_use =
> QuotaUsage.in_use + amount of quota requested.
>
> 2.3 Get the $generation_id by querying the ResourceProvider by the
> given resource_id.
>
> If the $generation_id is larger than the $generation_id in
> Step 1, then roll back transaction and GOTO step 1.
>
> this case means there is someone else has changed the
> QuotaUsage during this process.
>
> If the $generation_id is the same as the $generation_id in
> Step 1, then increase the ResourceProvider.generation_id by one and
>
> Commit the transaction. Done!
>
> Note: no case the $generation_id is less than the
> $generation_id in Step 1 because the $generation_id is nondecreasing.
>
>
> — Qijing
>
>
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 966 bytes
Desc: This is a digitally signed message part
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20160515/1c6d8ba2/attachment.pgp>
More information about the OpenStack-dev
mailing list