As explained in the NDB documentation : allocateIds(max=) will return the first available id if you try to reserve identifiers already allocated.
In your case, all identifiers up to 999999999 have already been allocated earlier (perhaps by other calls to allocate_ids ), 98765439124 is the first available identifier, 98765439123 is the last one that was allocated.
See the following example:
>>> Foo.allocate_ids(max=26740080011040) (26740080011031L, 26740080011040L)
Select all identifiers up to 26740080011040
>>> Foo.allocate_ids(max=26740080011040) (26740080011041L, 26740080011040L)
All identifiers up to 26740080011040 have already been allocated, the first identifiers available are 26740080011041, the last one allocated is 26740080011040
>>> Foo.allocate_ids(max=26740080011050) (26740080011041L, 26740080011050L)
Select all identifiers up to 26740080011050
source share