Search code examples
javagoogle-app-enginegoogle-cloud-datastore

Is there a way to "deallocate" id's that were allocated?


Let's say I have allocated a block of IDs using the allocateIdRange method. Is there a way to undo this? I'm nervous about allocating large chunks of IDs without having a way to undo it and potentially/accidentally allocating a large range of IDs that will never be able to be allocated again.


Solution

  • Short Answer: No, it is not possible to deallocate Ids after using allocateIdRange method.

    Long Answer: After a lot of testing with this method, I think it is not possible to "deallocate" those IDs. Even looking at the docs for Datastore or the docs for the App Engine API for any possible methods.

    Since you're concerned about allocating a lot and then not able to allocate again them because those are already reserved, I'll just say that being careful is the best option since there is no built-in method in the libs to deallocate.