Duplicate Error on Read-write enabled MariaDB Database

Hello everyone, I have been experiencing a problem while using frappe’s read-write feature and the updates referenced here.

I set up a primary-replica replication on AWS-managed MariaDB instances, I let the databases run uninterrupted for 24hours while I monitored and ran consistency tests on the replica database to confirm replication was active.

After activating and allowing frappe’s read-write feature to run for a few hours on a production site, I observed that a duplicate error 1062 is raised on the replica database, this stops the replication, and users on the production site are not able to fetch the most recent data.

I ran the sequence stated above twice and experienced the same error each time I activate read-write on Bench.

Could the read-write feature be responsible for writing directly to the replica database? because the error is not generated when the read-write feature is deactivated.
Could it be that the function is also switched and used for write operations?

In the interim, I have set the parameter group option for read_only to True if the database is a replica to restrict the database to only read operations.

I am aware that I can skip the error and move on but skipping errors could lead to database divergence.

Any information regarding this will be appreciated.