- isPersistentPayload = ((ReplicatedLogEntry)o).getData() instanceof PersistentPayload;
- }
-
- if(isPersistentPayload) {
- persistentProvider.persist(o, procedure);
+ Payload payload = ((ReplicatedLogEntry)o).getData();
+ if(payload instanceof PersistentPayload) {
+ // We persist the Payload but not the ReplicatedLogEntry to avoid gaps in the journal indexes
+ // on recovery if data persistence is later enabled.
+ persistentProvider.persist(payload, p -> procedure.apply(o));
+ } else {
+ super.persist(o, procedure);
+ }