For duplicate-entry-detection, I would like to generate named Entity-Keys
from a sequentially increasing index. (Entity "1", Entity "2", Entity "3",
...)
>From what I read about tablet-splitting and hot-spots, I understand that I
should avoid using just the text-string of the number as the key, since
that will eventually lead to many entities being stored physically very
close to each other (Entity "100000" is right next to Entity "100001", ...).
I am trying to figure out a quick and easy way to generate (preferably
minimal-length) Key names that spread the data nicely across storage
locations.
If I read correctly, named Keys are passed to the DataStore as UTF-8
encoded bytes, and any sorting on the Key is then performed versus these
UTF-8 bytes.
So, my current idea is to simply take my index value and generate a Key
name from it by expressing it as characters base-128 in little endian byte
order:
*String *keyName = *new String*(*new char*[] {(*char*) (index & 0x7F), (
*char*) ((index >>> 7) & 0x7F), (*char*) ((index >>> 14) & 0x7F), ...});
Should this work, or are there any restrictions on which 7-bit values I can
use? For example, is 0x00 reserved for some end-of-string marker or
similar? Would values in the non-displayable ASCII regions somehow
interfere with the Application Dashboard?
Or is there a better method altogether to generate such keys?
Thanks,
Markus
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/d/optout.