On Sat, Jan 29, 2011 at 5:11 PM, Colin Hawkett <[email protected]> wrote:

> Thanks for the info Calvin.
>
> I'm not too worried about the call being RPC slow, and I won't need to use
> it inside a transaction :)
>
> Looking at discussions 
> elsewhere<https://groups.google.com/d/msg/google-appengine-python/_AVE7D4P8tY/agOmNAOPSdYJ>,
> it would seem they should be reliably sequential (Nick Johnson's bulk load
> recommendation in that link wouldn't work if they were arbitrarily
> distributed I don't think).
>

> Whatever the case though - they *shouldn't* be increasing sequentially like
> they do in my example - they are 3 different 'kinds' - I was expecting each
> log line to be (1, 1) - is it the case that the SDK cheats a little here and
> has a single counter for all kinds?
>

The ids are unique, generally increasing, not usually sequential. Currently
in production there is one global id sequence (for root entities) and one
sequence per entity group (used for child entities). So it will look
something like:

   - Root: 1
      - Child: 1
      - Child: 2
      - Child: 3
   - Root: 2
      - Child: 1
      - Child: 2
      - Child: 3
   - Root: 3


In the dev_appserver there is one counter for the entire datastore. The
location of these counters may change in the future, the only thing
we guarantee is uniqueness.


>
> Probably the main thrust of the question though is whether it is fine to
> use arbitrary kind names as I have in the example. They're definitely
> not datastore kinds defined in my model.
>

Entities don't have to exist to use the key for id allocation


>
> I'm also interested if it is possible to reset the counter - or would you
> need to create a totally new app to achieve this? i.e. once they are
> allocated, they are allocated forever, end of story.
>

Not possible to reset an id sequence (though to get a new sequence you would
only have to switch keys, not apps)


>
> My thinking is 'why build a sharded counter if google's already got
> something that's suitable (for my use case)?' If its good enough for
> google...
>

allocate ids does not make a good counter. It may skip large ranges and is
almost certain to not count in order. It is designed to scale
for uniqueness not counting.


>
> Cheers,
>
> Colin
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-appengine%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to