Similar to what we do for Neo4j we could create the counters at start up if it doesn't exists already.
This way we don't need to check if the counter already exist every time we need to increment the sequence.
The improvement will affect only SequenceGenerator strategy counters.
Good idea. Also - beyond performing the necessary validations at bootstrap - I'd like to see the "hot path" of generating a new sequence number minimized to the smallest safe amount of code.
Essentially we might need a separate ClusteredCounterCommand for each sequence, and move most of the code in org.hibernate.ogm.datastore.infinispan.persistencestrategy.counter.ClusteredCounterCommand.nextValue(NextValueRequest) to its constructor.
Using metadata of SequenceGenerator strategy the counters can be created at start up without problems. The metadata of TableGenerator strategy does not contains instead the value of the property "pkColumnValue", mandatory for sequence creation: the name is derived from there. Can I apply the improvement only to SequenceGenerator strategy? Updating also this issue?
Sounds good to me