I am migrating some entities from an old appengine application to a new one (one reason beside others is to upgrade to objectify 5).
There are also some entities that have a automatically generated long id. Now I have to re-allocate the ids (see also the javadoc and this discussion) on the new datastore.
This are the important lines:
Long id = anEntity.getId();
com.google.appengine.api.datastore.KeyRange keyRange = new com.google.appengine.api.datastore.KeyRange(null, AnEntity.class.getName(), id-1l, id+1l);
KeyRange<AnEntity> keys = new KeyRange<>(keyRange);
OfyService.ofy().factory().allocateIdRange(keys);
However, this does not work as the exception below is thrown:
java.lang.IllegalArgumentException: Exceeded maximum allocated IDs
at com.google.appengine.api.datastore.DatastoreApiHelper.translateError(DatastoreApiHelper.java:54)
at com.google.appengine.api.datastore.DatastoreApiHelper$1.convertException(DatastoreApiHelper.java:127)
at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:96)
at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:88)
at com.google.appengine.api.datastore.FutureHelper.getInternal(FutureHelper.java:76)
at com.google.appengine.api.datastore.FutureHelper.quietGet(FutureHelper.java:36)
at com.google.appengine.api.datastore.DatastoreServiceImpl.allocateIdRange(DatastoreServiceImpl.java:121)
at com.googlecode.objectify.ObjectifyFactory.allocateIdRange(ObjectifyFactory.java:335)
I tested it further an found that the line
KeyRange(null, AnEntity.class.getName(), 1, 1000000000l);
would work. However, my already generated ids are in the range of 4503908059709440 to 6754883239673856 which is thus too high, obviously.
Did I made some mistake or does the allocateIdRange-method not support such big ids (As hinted here a long ago)?
If the latter, how could I go around this problem? (I thought of generating new ids in a certain range, but here they say that the legacy-way will soon be removed... Besides I don't like the idea of generating it by myself.)
System: - Java 7 - AppengineSDK 1.9.21 - objectify version: 4.1.3 (as said, I am migrating)
Thanks for any help.