Hello,

> 1. Assume I write data item X with a FULL_ASYNC write synchronization
> mode, what happens if I immediately attempt to read X?
> Will I read an old value or do I wait till the previous writes are
> completed?
It depends on the fact whether the write operation is executed on the
primary node or not.
In the latter case, you can read an old value because of the write operation
which doesn't wait for the update of the primary/backup.

> 2. If the write mode is PRIMARY_SYNC, will the immediate read operations
> on X get answered just the primary node
> or will I read an old value or wait for the previous write to complete?
In that case, the write operation returns control after the primary node has
been updated.
So, you can read an old value from backup. This behavior is controlled by
'readFromBackup' property (see CacheConfiguration#readFromBackup) which is
'true' by default.

In general, in case of write-then-read logic there are the following
guarantees of data consistency:
 - FULL_SYNC In this mode the write operation will not return control until
primary and backups are updated.
 - PRIMARY_SYNC In this mode the write operation will return control after
the primary node has been updated. Reading from backup nodes can be
forbidden by setting 'readFromBackup' to false.

[1]
https://ignite.apache.org/releases/2.2.0/javadoc/org/apache/ignite/configuration/CacheConfiguration.html#setReadFromBackup(boolean)
[2]
https://apacheignite.readme.io/docs/primary-and-backup-copies#synchronous-and-asynchronous-backups

Thanks.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Reply via email to