field truncate trying to using 'show slave status'

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
earlati
Posts: 18
Joined: Thu 18 Nov 2004 07:37
Location: Bergamo / Italy

field truncate trying to using 'show slave status'

Post by earlati » Tue 27 Dec 2005 13:41

I tried to read the value of field returned by the command 'show slave status' using a TMyQuery but most of the loger field are truncate.

The show slave state return a resultset with many field.
Some of them are trucate , for example the first field is 'Slave_IO_State' and should have a value like 'Waiting for master to send event', while the field returned by TMyQuery are truncate, i get only 'Waiting for ma'.

Also with mysql builder I get the field truncated.

Is this a limit of mysql ( I got the 5.0.15 wins revision ) or a MYDAC (rev 3.50) limit or I simply missed something else ?

regards, Enzo

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Thu 29 Dec 2005 12:29

This is MySQL server bug - it specifies wrong length for fields from SHOW statements. We avoided this bug in MyDAC 4 code.

earlati
Posts: 18
Joined: Thu 18 Nov 2004 07:37
Location: Bergamo / Italy

Post by earlati » Thu 29 Dec 2005 16:52

Ikar wrote:This is MySQL server bug - it specifies wrong length for fields from SHOW statements. We avoided this bug in MyDAC 4 code.

Gleb Paharenko of MySQL AB stated that the problem is not a mysql problem:

Da: Gleb Paharenko [mailto:[email protected]]
Inviato: martedì 27 dicembre 2005 17.13
A: [email protected]
Oggetto: Re: field truncate trying to using 'show slave status'


Hello.
> Is this a limit of mysql ( I got the 5.0.15 wins revision ) or a MYDAC >(rev 3.50) limit or I simply missed something else ?

I'm not a MYDAC (Delphi, C++ Builder) expert, but in my opinion, the problem is not in MySQL, because Query Browser and SQLyog use native MySQL C API and have no problems. MYDAC can work with MySQL in two ways - using MySQL client or native MySQL network protocol. Which of these two options are you using?

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Fri 30 Dec 2005 14:55

MyDAC reserves memory for field data on describing fields, before getting values from server. It's most effective method. Other products, which ignore performance, can detect end of string values by #0 terminator.

earlati
Posts: 18
Joined: Thu 18 Nov 2004 07:37
Location: Bergamo / Italy

Post by earlati » Fri 30 Dec 2005 15:42

Ikar wrote:MyDAC reserves memory for field data on describing fields, before getting values from server. It's most effective method. Other products, which ignore performance, can detect end of string values by #0 terminator.

But other products works :?
It is possible to have such fix on revision 3.5x ?
this is a big limit and don't want to move to rev 4. ,it is difficult to explain such situation to my boss.
:?

regards, enzo
btw , have an happy new year

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Thu 05 Jan 2006 10:32

We checked the problem once more. MySQL API function mysql_fetch_field_direct returns Field.Length = 14 for Slave_IO_state field.

> It is possible to have such fix on revision 3.5x ?

We will add code to avoid this problem in nearest build of MyDAC 3.55. Most likely, it will be available at the end of month.

Do you notice this problem only for Slave_IO_state field?

earlati
Posts: 18
Joined: Thu 18 Nov 2004 07:37
Location: Bergamo / Italy

Post by earlati » Mon 09 Jan 2006 15:17

Ikar wrote:We will add code to avoid this problem in nearest build of MyDAC 3.55. Most likely, it will be available at the end of month.
thanks, please if it is possible to get some hints to fix it by myself I would appreciate. I have to install on customer site before the end of the moth.
Ikar wrote:Do you notice this problem only for Slave_IO_state field?
I reported belowe the output I get from the standard mysql client and the one I get using MYDAC ( with some truncated values )

Code: Select all

  mysql> show slave status\G
*************************** 1. row ***************************
             Slave_IO_State: Waiting for master to send event
                Master_Host: 192.168.201.120
                Master_User: replicant
                Master_Port: 3306
              Connect_Retry: 60
            Master_Log_File: pmv_manager_log_bin.000002
        Read_Master_Log_Pos: 387980
             Relay_Log_File: Arlati-E-relay-bin.000002
              Relay_Log_Pos: 614
      Relay_Master_Log_File: pmv_manager_log_bin.000002
           Slave_IO_Running: Yes
          Slave_SQL_Running: No
            Replicate_Do_DB:
        Replicate_Ignore_DB:
         Replicate_Do_Table:
     Replicate_Ignore_Table: pmv_manager.lista_fep,pmv_manager.parametri_configurazione
    Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
                 Last_Errno: 1064
                 Last_Error: Error 'You have an error in your SQL syntax; check the manual that corresponds to ......            
               Skip_Counter: 0
        Exec_Master_Log_Pos: 467
            Relay_Log_Space: 388127
            Until_Condition: None
             Until_Log_File:
              Until_Log_Pos: 0
         Master_SSL_Allowed: No
         Master_SSL_CA_File:
         Master_SSL_CA_Path:
            Master_SSL_Cert:
          Master_SSL_Cipher:
             Master_SSL_Key:
      Seconds_Behind_Master: NULL

===================================

Code: Select all

fld[1/33] len=61 name=[Master_Host] value=[192.168.201.120] 
   fld[2/33] len=17 name=[Master_User] value=[replicant] 
   [ThrID=0944] [ClientXML] CONNESSIONE A 192.168.200.218 FALLITA
   fld[3/33] len=0 name=[Master_Port] value=[33  
   fld[4/33] len=0 name=[Connect_Retry] value=[60] 
   fld[5/33] len=512 name=[Master_Log_File] value=[pmv_manager_log_bin.000002] 
   fld[6/33] len=0 name=[Read_Master_Log_Pos] value=[342974] 
   fld[7/33] len=512 name=[Relay_Log_File] value=[Arlati-E-relay-bin.000002] 
   fld[8/33] len=0 name=[Relay_Log_Pos] value=[614] 
   fld[9/33] len=512 name=[Relay_Master_Log_File] value=[pmv_manager_log_bin.000002] 
   fld[10/33] len=3 name=[Slave_IO_Running] value=[Yes] 
   fld[11/33] len=3 name=[Slave_SQL_Running] value=[No] 
   fld[12/33] len=20 name=[Replicate_Do_DB] value=[] 
   fld[13/33] len=20 name=[Replicate_Ignore_DB] value=[] 
   fld[14/33] len=20 name=[Replicate_Do_Table] value=[] 
   fld[15/33] len=23 name=[Replicate_Ignore_Table] value=[pmv_manager.lista_fep,p] 
   fld[16/33] len=24 name=[Replicate_Wild_Do_Table] value=[] 
   fld[17/33] len=28 name=[Replicate_Wild_Ignore_Table] value=[] 
   fld[18/33] len=0 name=[Last_Errno] value=[1064] 
   fld[19/33] len=20 name=[Last_Error] value=[Error 'You have an e] 
   fld[20/33] len=0 name=[Skip_Counter] value=[0] 
   fld[21/33] len=0 name=[Exec_Master_Log_Pos] value=[467] 
   fld[22/33] len=0 name=[Relay_Log_Space] value=[343121] 
   fld[23/33] len=6 name=[Until_Condition] value=[None] 
   fld[24/33] len=512 name=[Until_Log_File] value=[] 
   fld[25/33] len=0 name=[Until_Log_Pos] value=[0] 
   fld[26/33] len=7 name=[Master_SSL_Allowed] value=[No] 
   fld[27/33] len=512 name=[Master_SSL_CA_File] value=[] 
   fld[28/33] len=512 name=[Master_SSL_CA_Path] value=[] 
   fld[29/33] len=512 name=[Master_SSL_Cert] value=[] 
   fld[30/33] len=512 name=[Master_SSL_Cipher] value=[] 
   fld[31/33] len=512 name=[Master_SSL_Key] value=[] 
   fld[32/33] len=0 name=[Seconds_Behind_Master] value=[]

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Tue 10 Jan 2006 10:55

> thanks, please if it is possible to get some hints to fix it by myself
We don't know way to avoid this problem without making changing to MyDAC or MySQL server code. If you have MyDAC Pro-version then send us (mydac*crlab*com) your license number and we will send small MyDAC patch to you.

> I get using MYDAC ( with some truncated values )

Please check truncated fields once more and specify their expected
maximum length.

earlati
Posts: 18
Joined: Thu 18 Nov 2004 07:37
Location: Bergamo / Italy

Post by earlati » Tue 10 Jan 2006 14:00

Ikar wrote:> We don't know way to avoid this problem without making changing to MyDAC or MySQL server code. If you have MyDAC Pro-version then send us (mydac*crlab*com) your license number and we will send small MyDAC patch to you.
.
I have the standard version.
I upgrade it from rev 3.50 to 3.55 but the file are truncated again.


Ikar wrote: Please check truncated fields once more and specify their expected
maximum length.
what I heed at present is the field Last_Error, which should have a very huge length ( I don't know what is is real limit ).
I suppose a limit of 32k should be enough.

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Tue 10 Jan 2006 16:21

> I have the standard version.

In this case we can't provide quick solution.

> I suppose a limit of 32k should be enough.

We don't want to change fieldtype and it's too long for TStringField. In
your case, is it enough to set Slave_IO_State length to 40, and
Last_Error length to 256?

earlati
Posts: 18
Joined: Thu 18 Nov 2004 07:37
Location: Bergamo / Italy

Post by earlati » Tue 10 Jan 2006 17:01

Ikar wrote: We don't want to change fieldtype and it's too long for TStringField. In
your case, is it enough to set Slave_IO_State length to 40, and
Last_Error length to 256?
A length of 40 for Slave_IO_State should be enough , also if 80 char should be better.
For Last_Error is required more space because it return the whole sql , in some case a stored procedure.
A value of 2k should be enough in most case, but is better 32k or at least 16k ( in few owrds it should be the bigger possible )

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Wed 11 Jan 2006 10:20

OK. In nearest build we will set Slave_IO_State to 80 and Last_Error to 2048.

earlati
Posts: 18
Joined: Thu 18 Nov 2004 07:37
Location: Bergamo / Italy

Post by earlati » Wed 11 Jan 2006 16:20

Ikar wrote:OK. In nearest build we will set Slave_IO_State to 80 and Last_Error to 2048.
I see that mydac 3.55 , is based on mysql client library 4.1.3.
It is not possible that this should be the cause of the wrong size value.
I'm using mysql 5 and maybe the client 4.1.3 should not be full compatible.
You told that mydac 4.00 have resolved the problem, what you mean exactly, how is solved the problem ?

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Thu 12 Jan 2006 10:35

> I'm using mysql 5 and maybe the client 4.1.3 should not be full compatible.

No, problem is on server side.

> You told that mydac 4.00 have resolved the problem, what you mean exactly, how is solved the problem ?

MyDAC will parse SQL and detect 'SHOW SLAVE STATUS' statement. If it is found then MyDAC sets fake values to field length.

earlati
Posts: 18
Joined: Thu 18 Nov 2004 07:37
Location: Bergamo / Italy

Post by earlati » Mon 06 Feb 2006 16:12

Ikar wrote:> I'm using mysql 5 and maybe the client 4.1.3 should not be full compatible.

No, problem is on server side.

> You told that mydac 4.00 have resolved the problem, what you mean exactly, how is solved the problem ?

MyDAC will parse SQL and detect 'SHOW SLAVE STATUS' statement. If it is found then MyDAC sets fake values to field length.
Today I registered to Mydac 4.30.
The problem were resolved, as you said, so I'm no more interested in a patch for the rev 3.5

Post Reply