This is only about SPIs, no new feature will be directly exposed as a result of this ticket.
First, we need to expose addOrUpdate on the PojoIndexer if we want to implement a mass indexer that works correctly with concurrent updates. We need this in Infinispan in particular.
Second, in Infinispan, indexing operations are always about a single entity/document, and contained types are irrelevant. Also, there is no concept of session, so the session is implemented as a singleton. Thus indexing in Infinispan does not need the PojoIndexingPlan and its overhead; Infinispan could use the PojoIndexer directly, if only it exposed the missing operations (addOrUpdate/delete/purge).
Ideally, we should also make the PojoIndexer and IndexIndexers thread-safe, so that Infinispan can use them as singletons. This means in particular fixing the lazy initialization we currently have in PojoIndexer. Maybe we should make the PojoIndexer type-scoped and initialize its delegates eagerly? That certainly wouldn't be a problem for the MassIndexer.
Finally, we'd also need to support DocumentCommitStrategy/DocumentRefreshStrategy in PojoIndexer/IndexIndexer operations. It's quite possible that Infinispan will need to force commit for each write in some situations, however bad performance will be. Maybe we'll be able to improve on that by adding DocumentCommitStrategy.WAIT_FOR/DocumentRefreshStrategy.WAIT_FOR, in another PR. |
|