google-code-export / objectify-appengine

Automatically exported from code.google.com/p/objectify-appengine
MIT License
1 stars 0 forks source link

allocateIds does not operator within the kind namespave #44

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I would have expected ObjectifyFactory's allocateIds(java.lang.Class<T> clazz, 
long num) to preallocate a contiguous range of unique ids within the namespace 
of the specified entity class.

It appears to allocated ids paying no attention to the namespace.

I have attached an updated AllocateTests for verification.

Original issue reported on code.google.com by btoc...@gmail.com on 25 Jun 2010 at 3:44

Attachments:

GoogleCodeExporter commented 9 years ago
I looked into this and concluded:

1) The code is correctly calling the right SDK methods
2) The allocator is allocating numbers irrespective of namespace

This shouldn't actually be unexpected.  GAE guarantees that allocation of ids 
in a namespace will prevent those ids from being reused, but nowhere does it 
guarantee that ids are allocated contiguously within a namespace.  My guess is 
that the development environment simply uses a single unsharded counter for all 
namespaces; it meets the requirements even if it doesn't produce "pretty" ids.  
I don't know offhand if GAE production follows this same shortcut approach; I 
suspect not, but experiment and let us know.

Original comment by lhori...@gmail.com on 30 Jun 2010 at 2:30