Datastore concurrency mode migration

Hi

Initially we were using app engine standard v1 (legacy) and datastore legacy.

Then we migrated our datastore to Firestore as datastore mode. This converted the concurrency mode to OPTIMISTIC_WITH_ENTITY_GROUPS.


Now we need to change this concurrency mode to "Optimistic" to have support of the TTL feature.

I tried adding the TTL in one of the table of datastore table, but then it says that TTL feature is not supported with concurrency mode OPTIMISTIC_WITH_ENTITY_GROUPS.


There is a way to change the concurrency mode, as per the following doc

https://cloud.google.com/datastore/docs/concepts/transactions#concurrency_modes

What does it mean by changing the concurrency of the project to Optimistic? I need to change the concurrency mode of datastore and not the GCP project.


I've following questions

  1. Considering the our production project, there are many datastore tables with many GBs of data, what would be the best and safest way to change the concurrency mode?
  2. How to know which tables are being used in Entity Group transactions?
  3. If we remove the dependencies over these Entity Group transactions tables and delete them from our current datastore table, then will it be safer to change the concurrency mode?
2 2 96
2 REPLIES 2

Hi @zubairalam ,

I think this is what they recommend to make that change that you're trying. It seems that the most reliable way is to use a test project, make the change there, test it as much as you can and if everything works; then, make the change in your production project.

Mind that I haven't done that myself. I guess I got lucky because I did absolutely nothing to my datastore in any project I own and I'm able to use TTL where I've tried, so I guess when they migrated them to Firestore in Datastore mode they ended up having Optimistic concurrency mode...as I believe happened for most cases when they did that migration.

Best,

Michael

l also would like more information about this. What is the behavior that OPTIMISTIC_WITH_ENTITY_GROUPS is designed for instead of just plain OPTIMISTIC? Or alternatively: What Datastore access pattern in an application would cause problems if OPTIMISTIC_WITH_ENTITY_GROUPS is not set? The documentation does not explain this.