content_image/784402.jpg
•Most memcached  operations are mapped to DML statements (analogous to insert, delete, update). Since there is no actual SQL statement being processed by the MySQL server, all memcached commands (except for flush_all ) use Row-Based Replication (RBR) logging, which is independent of any server binlog_format  setting. 

•The memcached flush_all  command is mapped to the TRUNCATE TABLE  command in MySQL 5.7 and earlier. Since DDL commands can only use statement-based logging, the flush_all  command is replicated by sending a TRUNCATE TABLE  statement. In MySQL 8.0 and later, flush_all  is mapped to DELETE  but is still replicated by sending a TRUNCATE TABLE  statement. 

Transactions: 

•The concept of transactions has not typically been part of memcached  applications. For performance considerations, daemon_memcached_r_batch_size  and daemon_memcached_w_batch_size  are used to control the batch size for read and write transactions. These settings do not affect replication. Each SQL operation on the underlying InnoDB  table is replicated after successful completion. 

•The default value of daemon_memcached_w_batch_size  is 1 , which means that each memcached  write operation is committed immediately. This default setting incurs a certain amount of performance overhead to avoid inconsistencies in the data that is visible on the source and replica servers. The replicated records are always available immediately on the replica server. If you set daemon_memcached_w_batch_size  to a value greater than 1 , records inserted or updated through memcached  are not immediately visible on the source server; to view the records on the source server before they are committed, issue SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED . 

## 15.20.8 InnoDB memcached Plugin Internals 

## InnoDB API for the InnoDB memcached Plugin 

The InnoDB memcached  engine accesses InnoDB  through InnoDB  APIs, most of which are directly adopted from embedded InnoDB . InnoDB  API functions are passed to the InnoDB memcached  engine as callback functions. InnoDB  API functions access the InnoDB  tables directly, and are mostly DML operations with the exception of TRUNCATE TABLE . 

memcached  commands are implemented through the InnoDB memcached  API. The following table outlines how memcached  commands are mapped to DML or DDL operations. 

<img src='content_image/784402.jpg'>

