Note that there are some explanatory texts on larger screens.

plurals
  1. POmysql proxy r/w replication and temporary tables
    primarykey
    data
    text
    <p>I am doing master/slave replication on MySQL5.1 and r/w split with mysql proxy 0.8.x</p> <p>It works fine except with temporary tables. MySQL throws an error, that the temporary table is not existent.</p> <p>This is the query log for the master server:</p> <pre><code> CREATE TEMPORARY TABLE IF NOT EXISTS sh ( ad_id MEDIUMINT( 8 ) UNSIGNED NOT NULL, score float , INDEX ( `ad_id` ), INDEX ( `score` )) ENGINE = MEMORY INSERT INTO sh SELECT cl.ID, 1 FROM classifieds cl WHERE cl.advertiser_id = '40179' </code></pre> <p>This is the query log for the slave:</p> <pre><code>CREATE TEMPORARY TABLE IF NOT EXISTS sh ( ad_id MEDIUMINT( 8 ) UNSIGNED NOT NULL, score float , INDEX ( `ad_id` ), INDEX ( `score` )) ENGINE = MEMORY </code></pre> <p>This is the mysql errror message:</p> <pre><code>Occured during executing INSERT INTO sh SELECT cl.ID, 1 FROM classifieds cl WHERE cl.advertiser_id = '40179' statement Error: 1146 Table 'dbname.sh' doesn't exist </code></pre> <p>If I query the master directly (change php db connection to master instead to mysql-proxy), it works without problems. </p> <p>I am using this mysql proxy config:</p> <pre><code>[mysql-proxy] daemon = true pid-file = /home/mysqladm/mysql-proxy.pid log-file = /home/mysqladm/mysql-proxy.log log-level = debug proxy-address = 192.168.0.109:3307 proxy-backend-addresses = 192.168.0.108:3306 proxy-read-only-backend-addresses = 192.168.0.109 proxy-lua-script = /usr/local/mysql-proxy/share/doc/mysql-proxy/rw-splitting.lua </code></pre> <p>Has anybody an idea on how to fix that? Thank you for any help!</p> <p>// edit next day</p> <p>I believe I know why this isn't working:</p> <p>MySQL Proxy sends the create tmp and insert select statements to the master which replicates the commands correctly to the slave, then in the next step the select is sent to the slave. Unfortunatelly in MySQL the tmp table is only valid for the connection which issued it, therefore the tmp table created by the replication is not valid for the second connection issued by mysql proxy on slave.</p> <p>I am now trying to solve this by changing my application and issuing connects with tmp tables directly to the master. </p> <p>Please let me know if you believe that there is a better solution. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload