除了调用 put 操作之外,Hazelcast 地图元素何时会被持久化?
我有一个带有 2 个节点的 hazelcast 集群和一个用于持久性的数据库。我依次启动两个节点。第一个节点从DB中读取实体并构建相应的映射(entityMap)。启动第二个节点后,EntityMapStore.store() 方法(在第二个节点上)定期调用相当多次。 我只是想知道,这应该怎么发生,因为开始后我还没有在地图中放入任何东西。或者我做错了什么?
hazelcast.xml 的相应部分如下所示:
<map name="entityMap">
<backup-count>1</backup-count>
<map-store enabled="true">
<class-name>EntityMapStore</class-name>
<write-delay-seconds>1</write-delay-seconds>
</map-store>
</map>
I have a hazelcast cluster with 2 nodes and a DB for the persistence. I start the two nodes one after the other. The first node reads the entities from the DB and build the corresponding map (entityMap). After I start the second node, the EntityMapStore.store() method is called (on the 2nd node) regularly for quite a few times.
I am just wondering, how should this happen, because after starting I have not put anything into the map. Or did I do something incorrectly?
The corresponding part of the hazelcast.xml looks like:
<map name="entityMap">
<backup-count>1</backup-count>
<map-store enabled="true">
<class-name>EntityMapStore</class-name>
<write-delay-seconds>1</write-delay-seconds>
</map-store>
</map>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,你没有做错任何事。由于您有 write-delay-seconds > 0,当条目迁移到第二个节点时,会在第二个节点上为这些条目调用
store()
。这是当前的行为,但您可能需要为此创建问题,以便 Hazelcast团队可以通过不对迁移的脏条目调用store()
来增强此行为。No. You are not doing anything wrong. Since you have
write-delay-seconds > 0
, when entries migrates to the second node,store()
is called for these entries on the second node. This is the current behavior but you might want to create an issue for this so that Hazelcast team can enhance this behavior by not callingstore()
for the migrated undirty entries.