Hi!
I've been looking for a solution for this problem on IRC and mysql forums but without any luck so I try here.
I'm using FreeBSD 6.2 with FreeBSD port "mysql-server-5.0.51a" and MySQLdb-1.2.2.
When executing the following script:
>>> import MySQLdb
>>> db = MySQLdb.connect('127.0.0.1', 'root')
>>> c = db.cursor()
>>> c.execute("UPDATE temp.test SET field=1")
1L
>>> db.commit()
>>> db.close()
the updated value is indeed shown on the local mysql server,
but not when selecting the same field from a slave database that is replicating this field.
For some reason, no updates are shown on replication. But no errors are shown either and the update gets stored on the database that I connect to.
If I update the exact same field with the mysql command line tool (or PHP mysqli module), the value also changes on the slave server as it should be.
Any idea of how to solve this?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I found out why this happend now :)
Sorry to blaim the mysqldb guys, it was a general mysql problem.
When I do this: "update database.table set field=1" it gets saved but NOT replicated.
While instead doing this: "use database; update table set field=1", it gets replicateed.
No warnings, no errors, it gets saved in both cases. So why does it not replicate? I think it's very strange, I'll have to ask the mysql guys
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It's got to be your replication setup based on your description. What you're doing looks right, and there's nothing in MySQLdb that could affect replication.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The question is though,
why does the slave get updated when I use any other tool but mysqldb?
Even doing it like "set autocommit = 0; begin ... update ... commit" from the mysql command tool works.
I will try to sniff the traffic to compare the difference and see what it gives.
The replication setup has never had any troubles before, only just now when starting with python scripts
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi!
I've been looking for a solution for this problem on IRC and mysql forums but without any luck so I try here.
I'm using FreeBSD 6.2 with FreeBSD port "mysql-server-5.0.51a" and MySQLdb-1.2.2.
When executing the following script:
>>> import MySQLdb
>>> db = MySQLdb.connect('127.0.0.1', 'root')
>>> c = db.cursor()
>>> c.execute("UPDATE temp.test SET field=1")
1L
>>> db.commit()
>>> db.close()
the updated value is indeed shown on the local mysql server,
but not when selecting the same field from a slave database that is replicating this field.
For some reason, no updates are shown on replication. But no errors are shown either and the update gets stored on the database that I connect to.
If I update the exact same field with the mysql command line tool (or PHP mysqli module), the value also changes on the slave server as it should be.
Any idea of how to solve this?
I found out why this happend now :)
Sorry to blaim the mysqldb guys, it was a general mysql problem.
When I do this: "update database.table set field=1" it gets saved but NOT replicated.
While instead doing this: "use database; update table set field=1", it gets replicateed.
No warnings, no errors, it gets saved in both cases. So why does it not replicate? I think it's very strange, I'll have to ask the mysql guys
See what this does:
>>> import MySQLdb
>>> db = MySQLdb.connect('127.0.0.1', 'root', db="temp")
>>> c = db.cursor()
>>> c.execute("UPDATE test SET field=1")
>>> db.commit()
>>> db.close()
You shouldn't use "USE database" as SQL; use db.select_db(database) instead if you have to change databases after the initial connection.
It's got to be your replication setup based on your description. What you're doing looks right, and there's nothing in MySQLdb that could affect replication.
The question is though,
why does the slave get updated when I use any other tool but mysqldb?
Even doing it like "set autocommit = 0; begin ... update ... commit" from the mysql command tool works.
I will try to sniff the traffic to compare the difference and see what it gives.
The replication setup has never had any troubles before, only just now when starting with python scripts