Вопрос

I'm concerning a failover scenario for a persistence and I'm considering the way it should be properly implemented. Out of previous experience I'm thinking that in case underlying persistence failed to store entity, it should be able to store it later as soon as problem will be solved. In terms of Hazelcast entity being cached in map has states that manage it's relation to MapStore.

What happens if MapStore implementation fails to store? How to make entity to be re-applyied to MapStore business?

Update:

It's not a problem to implement failover in MapStore itself to keep entries in queue unless underlying persistence business will become available but this breaks ideas of distributed memory. On the other hand it potentially can cause inconsistencies if data appeared in MapStore will be put back to cache, isn't it?

Это было полезно?

Решение

A persistency can be configured either

  • Write through
  • Write behind.

In case of write through, if MapStore fails for some reason, you'll get exception on map.put.

In case of write behind, Every 10(default) seconds Hazelcast will persist all dirty entries as a bulk. If MapStore throws an Exception, those entries are marked as dirty and in the next run, they are passed to the MapStore again. Basically Hazelcast will continue to store them until the MapStore.storeAll() succeeds. From what I understand, your case fals into this category and Hazelcast does provide a failover.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top