RE: [firebird-support] backup on amd64 restore on raspberry pi 3

2018-08-29 Thread 'Paul Beach' pbe...@mail.ibphoenix.com [firebird-support]
Et al,

> on https://www.ibphoenix.com/resources/documents/general/doc_323
> "Rows are restricted to 32767 bytes."

That doc has now been updated to reflect all versions of Firebird upto Firebird 
3.

Regards
Paul



Re: [firebird-support] backup on amd64 restore on raspberry pi 3

2018-08-26 Thread Mark Rotteveel m...@lawinegevaar.nl [firebird-support]
On 25-8-2018 20:46, pab...@adinet.com.uy [firebird-support] wrote:
> Mark, checking on max row size I find :
> 
> on https://www.ibphoenix.com/resources/documents/general/doc_323
> "Rows are restricted to 32767 bytes."
> 
> on https://www.firebirdsql.org/en/firebird-technical-specifications/
> "Maximum row size     64 KB"
> 
> Counting first reference, I'm out of bounds big time ...
> 
> CREATE TABLE TABLALOG
> (
>    NID ENTERO NOT NULL,
>    NUSUARIO ENTERO NOT NULL,
>    TSINGRESO T_STAMP,
>    DALCANCE CHAR_255CI,
>    DAPP CHAR_50CI,
>    OEVENTO CLA_SHORT,
>    DIPV4 CHAR_15,
>    DIPV6 CHAR_50,
>    DHOST CHAR_255CI,
>    DENTIDAD CHAR_50CI,
>    OACCION CHAR_50CI,
>    DCONTENIDO VARCHAR(32765),
>    CONSTRAINT PK_TABLALOG PRIMARY KEY (NID)
> );
> 
> Where domains are:
> ENTERO integer
> T_TAMP is a timestamp
> CHAR_255CI varchar(255) AI_CI
> CHAR_50 varchar(50) AI_CI
> CHAR_15 varchar(15) AI_CI
> CLA_SHORT short
> 
> Database is generated as ISO-8859-1, so using 2 bytes per char, I think
> I'm past all bounds..

You are not, ISO-8859-1 is a single byte character set, so your row is 
33526 bytes, which is far below 64kb.

> I recreated the varchar(32765) attribute to varchar(255), backuped an 
> restored. The error now shows on another table which has more than 32767 
> bytes (another log table, almost identical):
> gbak:    restoring index PK_ERRORLOG
> gbak:restoring data for table ERRORLOG
> gbak: ERROR:message length error (encountered -32512, expected 33024)
> gbak: ERROR:gds_$send failed
> gbak:Exiting before completion due to errors
> 
> 
> I guess I must use a 32 kbytes max instead of 64kbytes, right?

I'm not sure how and why you made the leap from me telling that this 
seems to be a mixup in signed and unsigned integers, from thinking that 
this has to do with row sizes. It doesn't.

This would indicate a bug in the gbak on the raspberry pi port. Either 
with using wrong integer sizes (16 bit vs 32 bit) or wrong integers 
(signed vs unsigned).

Report a bug in the tracker or to the downstream maintainer of the 
Raspberry Pi port you're using (as the Firebird project itself doesn't 
produce that port AFAIK).

> How two byte per char count here ?
> 
> Is the limit for record declaration or actual record size ?
> 
> I'm worried that server didn't yelled at me when generating/altering 
> database ddl .

If you created a row that was too wide, the server would let you know.

Mark
-- 
Mark Rotteveel


Re: [firebird-support] backup on amd64 restore on raspberry pi 3

2018-08-25 Thread Mark Rotteveel m...@lawinegevaar.nl [firebird-support]
On 24-8-2018 18:31, pab...@adinet.com.uy [firebird-support] wrote:
> As I could backup and restore databases from and to firebird 3 on the 
> same running platform, next step is apply it to raspberry pi.
> 
> I'm getting the following when restoring the same backup file wich 
> should be "transportable by default" :
> 
> gbak:opened file  mybackup-file.fbk
> gbak:transportable backup -- data in XDR format
> gbak:        backup file is compressed
> gbak:backup version is 10
> gbak:created database mydb, page_size 8192 bytes
> gbak:started transaction
> ...
> gbak:    restoring index RDB$PRIMARY1
> gbak:restoring data for table PLG$SRP
> gbak:   2 records restored
> gbak:    restoring index PK_TABLALOG
> gbak:    restoring index FK_TABLALOG_USUARIO
> gbak:restoring data for table TABLALOG
> gbak: ERROR:message length error (encountered -31984, expected 33552)
> gbak: ERROR:gds_$send fa iled
> gbak:Exiting before completion due to errors
> 
> Are format in these platforms compatible ? Both are, at least, little 
> endian.

It looks like a mix up of signed and unsigned 16 bit ints. -31984 is a 
signed 16 bit int as hex 0x8310, and as unsigned 16 bit int, that is 33552.

> Restoring file from v2.5 backup, gets the same problem .
> 
> Maybe I stop amd64 server and copy live db to rpi ?

Probably not. The database can use platform specific representations of 
data, and index values depend on the installed ICU version.

-- 
Mark Rotteveel