Subject Re: [firebird-support] external table filesystem layout changed?
Author Christian Stengel
Am 05.06.2007 um 18:24 schrieb Ann W. Harrison:
> > did the layout of external files change from 1.5.x to 2.0?
> >
>
> What I think you're seeing is a change in alignment rules that puts
> all bigints on 64bit boundaries.

I thought that too - but if the first field is an int field, it
starts at byte 4:

create table A7 external file '/database/external/a7' (a time, b
bigint,c bigint);
insert into a7 values ('00:00:01',1,2);

e:~ chris$ hexdump -C /database/external/a7
00000000 10 27 00 00 01 00 00 00 00 00 00 00 02 00 00 00
|.'..............|
00000010 00 00 00 00

If I have multiple int fields after that one, the additional 4 bytes
are used first.

SQL> create table A9 external file '/database/external/a9' (b bigint,
a time,n integer,c bigint);
SQL> insert into a9 values (1,'00:00:01',2,3);

e:~ chris$ hexdump -C /database/external/saLog/a9
00000000 01 00 00 00 00 00 00 00 10 27 00 00 02 00 00 00
|.........'......|
00000010 03 00 00 00 00 00 00 00

SQL> create table A10 external file '/database/external/a10' (b
bigint, a time,n integer,o integer,c bigint);
SQL> insert into a10 values (1,'00:00:01',2,3,4);

e:~ chris$ hexdump -C /database/external/a10
00000000 01 00 00 00 00 00 00 00 10 27 00 00 02 00 00 00
|.........'......|
00000010 03 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00
|................|
00000020

I figured out, that for one int / long value a 8 byte field is
reserved only after a bigint occurres - if two int / long fields
follow, the second 4 bytes are used for that - if three int / long
fields are used, 16 bytes are reserved. So the 64 bit boundaries only
start after one single bigint field.

Is that right? Will that behavior change again in the future?

Thanks a lot,

Christian