NDB Cluster Replication Conflict Resolution Conflict Resolution Functions The next few paragraphs provide detailed information about the functions which can be used for conflict detection and resolution with NDB Replication. NDB$OLD(column_name).  If the value of  column_name  is the same on both the source and the replica, then the update is applied; otherwise, the update is not applied on the replica and an exception is written to the log. This is illustrated by the following pseudocode:  This function can be used for “same value wins”  conflict resolution. This type of conflict resolution ensures that updates are not applied on the replica from the wrong source. The column value from the source’s “before”  image is used by this function. NDB$MAX(column_name).  If the “timestamp”  column value for a given row coming from the source is higher than that on the replica, it is applied; otherwise it is not applied on the replica. This is illustrated by the following pseudocode:  This function can be used for “greatest timestamp wins”  conflict resolution. This type of conflict resolution ensures that, in the event of a conflict, the version of the row that was most recently updated is the version that persists. The column value from the sources’s “after”  image is used by this function. NDB$MAX_DELETE_WIN().  This is a variation on  NDB$MAX() . Due to the fact that no timestamp is available for a delete operation, a delete using  NDB$MAX()  is in fact processed as  NDB$OLD , but for some use cases, this is not optimal. For  NDB$MAX_DELETE_WIN() , if the “timestamp”  column value for a given row adding or updating an existing row coming from the source is higher than that on the replica, it is applied. However, delete operations are treated as always having the higher value. This is illustrated by the following pseudocode:  This function can be used for “greatest timestamp, delete wins”  conflict resolution. This type of conflict resolution ensures that, in the event of a conflict, the version of the row that was deleted or (otherwise) most recently updated is the version that persists. As with  NDB$MAX() , the column value from the source’s “after”  image is the value used by this function. NDB$EPOCH().  The  NDB$EPOCH()  function tracks the order in which replicated epochs are applied on a replica cluster relative to changes originating on the replica. This relative ordering is used 4644 Note if ( ( source_new_column_value  >  replica_current_column_value ) || operation.type  == "delete") apply_update(); if ( source_new_column_value  >  replica_current_column_value ) apply_update(); if ( source_old_column_value  ==  replica_current_column_value ) apply_update(); else log_exception(); Important Important