“for 4.1 specifically we recommend 4.1.20 or higher. Some Linux distributions (most important RHEL4) originally shipped with 4.1.10. This version has serious bugs in charset handling (of which most were fixed in 4.1.12). Official RHEL 4.1.20 builds are available for upgrade by RHEL4 users.”
.. and I can add that you can download 4.1.22 from any MySQL FTP-mirror like here: ftp://mirrors.dotsrc…oads/MySQL-4.1/ .. but note that MySQL do not support 4.1 anymore and also 5.0 will go out of support by end of this month (unless they change their plans).
Without have tried your dumps I am convinced it is a server issue. Refer to: http://dev.mysql.com…news-4-1-x.html . 4.1.7 was released as 'production quality' but it is buggy as regards charset handling (COLLATIONS were completely new to MySQL in 4.1 – earlier MySQL versions did not have)! Why was that server not upgraded long ago?
But the editor will not recognize anything but ANSI, UFT8 and 'Windows Unicode'. Do strings you copy from that website display OK in the SQLyog editor? Did you try different browsers?
If we shall help you have have to reply to our questions as well!
oops .. I think we overlooked your last post. We will look at the files now (what will probably be tomorrow morning). You did not tell the server version(s). Please tell.
.. but when I copy from my browser here (Opera) it seems that Opera returns UTF8 to the clipboard. I did not try other browsers. You should try both uft8 and gb2312 for the column, I think.
This charset is not supported by MySQL currently. It has been planned for years but there seems to be not much progress. If gb2312 uses a byte sequence that is invalid in UTF8 truncation may occur. I am not sure it is the problem though.
“somehow the INSERT gives an error when the user is not granted UPDATE”. I do not think it does. With my test case it does not. Only the console output is not clear (the error text occurs just below the INSERT in the header).
I think the reason why we print the error at once is that if SJA should abort or crash it may not be able to print it if it is saved in memory for later printing. But a developer has promised to look into code and find how and why the error is generated.
but note that it inserts one row and updates and deletes none.
Table in sbase looks like after sync
id txt
1 x
2 b
3 c
4 d
5 blah
(note that 2nd row is still 'b' and not 'y' here)
the sja.log has this ” UPDATE command denied to user 'suser'@'localhost' for table 'onetable' “.
So the only problem I see is a cosmetical issue that an error prints where it disturbs the output in the console. The server-side privileges prevent the operations you do not want and you get the expected result from the sync as far as I can see. What say?
Anyway we should check what exactly raises the message and consider a more descriptive error message (like “not all operations could be performed due to lack of privivleges”) after the tabular view.
To reproduce and understand the problem (with my test case)
CREATE DATABASE sbase;
USE sbase;
CREATE TABLE `onetable` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`txt` VARCHAR(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
INSERT INTO `onetable`(`id`,`txt`) VALUES (1,'x'),(2,'b'),(3,'c'),(4,'d');
CREATE DATABASE tbase;
USE tbase;
CREATE TABLE `onetable` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`txt` VARCHAR(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
INSERT INTO `onetable`(`id`,`txt`) VALUES (1,'a'),(2,'b'),(3,'c'),(5,'blah');
— This will (with a 2-way sync)
— * update row-1 from sbase to tbase
— * insert row-4 from sbase to tbase
— * insert row-5 from tbase to sbase
— and you want/expect it to work with the minimal privileges like here:
GRANT SELECT, INSERT ON sbase.* TO suser@localhost;
GRANT SELECT, INSERT, UPDATE ON tbase.* TO tuser@localhost;
I frist run a one-way sync sbase>tbase (wiht “don't delete” option checked and using suser and tuser for conenction respectively). It inserts one row and updates one row on tbase. Now table in tbase looks like
id txt
1 x
2 b
3 c
4 d
5 blah
Next I UPDATE manually (simulating what happens on your environment) b >> y in 2nd row of table in tbase and run a 1-way sync in the other direction. SJA returns an error in the log:
Table SrcRows TgtRows Inserted Updated Deleted
========================= ======= ======= ======== ======= =======
`onetable` 5 4 There was an error while executing a query. The query and the error has been logged in the log file.
1 0 0
Total time taken – 0 sec(s)
This is happening with INSERTED what is pretty strange as nothing should prevent INSERT (I think it is logging the error the wrong place in this case and the error description is definitely not very good). But I think we understand you now and I will ask developers to debug exactly what happens. It may take some days before we can reply. Could you please confirm the validity and usability of my test case?
I think it is a reasonable request to to be able to skip INSERTS or UPDATES (just like we can now skip DELETES with a one-way sync). I would be little bit of a 'hack' I think to handle this with server-side privilege management – but maybe an acceptable workaround for now.
A two-way sync will never update from target to source except for the situation where data on target have changed in the time-slice between the two 'sync-rounds'. An that situation is what you try to prevent by denying UPDATE privilege. And that leads then to failures with INSERT?
I am sorry but this discussion is too 'wordy'. It would be better if you provided reproducible steps in terms of SQL.
“But in my case the target WILL update the source in the second run”
OK, so I understand with this particular setup you simply *want to* prevent changes on the (s) to write back toby managing privileges on. Right?
There is a 'abort on error' setting. What is your setting here – YES or NO? I think that NO will simply proceed to next statement (but still you will get an error recorded in the log for every UPDATE that failed).
Please confirm that I understood. I will write an example/testcase in SQL:
Code:
CREATE DATABASE sbase;
USE sbase;
CREATE TABLE `onetable` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`txt` VARCHAR(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
INSERT INTO `onetable`(`id`,`txt`) VALUES (1,'x'),(2,'b'),(3,'c'),(4,'d');
CREATE DATABASE tbase;
USE tbase;
CREATE TABLE `onetable` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`txt` VARCHAR(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
INSERT INTO `onetable`(`id`,`txt`) VALUES (1,'a'),(2,'b'),(3,'c'),(5,'blah');
— This will (with a 2-way sync)
— * update row-1 from sbase to tbase
— * insert row-4 from sbase to tbase
— * insert row-5 from tbase to sbase
— and you want/expect it to work with the minimal privileges like here:
GRANT SELECT, INSERT ON sbase.* TO suser@localhost;
GRANT SELECT, INSERT, UPDATE ON tbase.* TO tuser@localhost;