Explicit setting of write synchronization mode FUL

2019-08-27 01:28发布

问题:

I understand from the docs that replicated caches are implemented using partitioned caches where every key has a primary copy and is also backed up on all other nodes in the cluster & that when data is queried lookups would be made from both primary & backup on the node for serving the query.

But i see that the default cache write synchronization mode is PRIMARY_SYNC, where client will not wait for backups to be updated. Does that mean i have to explicitly set it to FULL_SYNC for replicated caches since responses rely on lookup of primary & backup?

回答1:

The first option is to use 'FULL_SYNC' mode. In that case, client request will wait for write to complete on all participating nodes (primaries and backups).

The second option, that can be used here, is to use 'PRIMARY_SYNC' and set 'CacheConfiguration#readFromBackup' flag to false (which is true by default). Ignite will send the request to primary node and get the value from there.

Please see https://ignite.apache.org/releases/mobile/org/apache/ignite/configuration/CacheConfiguration.html

By the way, both options make sense for partitioned cache as well.