Does master-slave replication ensure records appear in subsequent readings?

Here is a very simple replication question.

If you configured your database using master-slave replication, where records go to the master and read, go to the slaves, does this mean that the newly written data will not necessarily be displayed in read mode until some time later

For example, suppose a user submits a comment to your site (record: INSERT INTO comment ...) and then refreshes the page (read: SELECT * FROM comment ...). Reading goes to the slave where the INSERT statement is not yet replicated, so the list of comments is returned without a new one. This will effectively disrupt the ACID "Durability" portion, at least temporarily.

How it works? Or is there a way to make sure that users can always read what they just wrote?

+4
source share
1 answer

Master-> Databases replication databases into which the main database is written and the slave is read. When an INSERT is placed in the main database, the slave will contain this information, provided that the master-> slave is configured and synchronized. So, for example, if I wrote:

INSERT into TEST_TABLE (col1, col2) values ("test", 123);

If I went to a working database and asked:

SELECT col1, col2 FROM TEST_TABLE;

, . SQL, master- > slave-. , , SQL , , .

+2

All Articles