Create the counters at start up in Infinispan Embedded

Description

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.

Environment

None

Activity

Show:
Sanne Grinovero
January 31, 2018, 2:53 PM

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.

Fabio Massimo Ercoli
February 6, 2018, 2:11 PM

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?

Davide D'Alto
February 6, 2018, 2:12 PM

Sounds good to me

Fixed

Assignee

Fabio Massimo Ercoli

Reporter

Davide D'Alto

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

Yes, likely

backportDecision

None

backportReEvaluate

None

Components

Fix versions

Priority

Major