Subject | Stream BLOBs |
---|---|
Author | Nickolay Samofatov |
Post date | 2003-11-17T17:31:40Z |
Hello, All !
Current CVS HEAD of Jaybird uses stream blobs by default.
When long BLOBS are used resulting database cannot be backed up.
I tested Firebird 2.0 and Firebird 1.5, but I do not see any
difference in Firebird 1.0 codebase so I expect to see the same
problems.
GBAK returns the following messages during backup attempt:
----------------
gbak: ERROR: segment buffer length shorter than expected
gbak: ERROR: gds_$get_segment failed
gbak: Exiting before completion due to errors
----------------
The problem internally is caused by the following piece of code:
------------ blb.cpp: BLB_get_segment --------------------------
/* If this is a stream blob, fake fragment unless we're at the end */
if (STREAM)
blob->blb_fragment_size =
(blob->blb_seek == blob->blb_length) ? 0 : 1;
----------------------------------------------------------------
and then
------------ jrd.cpp: GDS_GET_SEGMENT --------------------------
if (blob->blb_flags & BLB_eof) {
JRD_restore_context();
--dbb->dbb_use_count;
return (user_status[1] = isc_segstr_eof);
}
else if (blob->blb_fragment_size) {
JRD_restore_context();
--dbb->dbb_use_count;
return (user_status[1] = isc_segment);
}
----------------------------------------------------------------
i.e. isc_get_segment always returns "segment buffer length shorter
than expected" error when called for long stream blob.
I think that Jaybird should avoid using stream blobs when used against
Firebird 1.0 databases.
I think that returning success from isc_get_segment for partially read
stream blobs would be the correct solution for Firebird 1.5 and 2.0.
Suggestions ?
--
Best regards,
Nickolay Samofatov mailto:skidder@...
Current CVS HEAD of Jaybird uses stream blobs by default.
When long BLOBS are used resulting database cannot be backed up.
I tested Firebird 2.0 and Firebird 1.5, but I do not see any
difference in Firebird 1.0 codebase so I expect to see the same
problems.
GBAK returns the following messages during backup attempt:
----------------
gbak: ERROR: segment buffer length shorter than expected
gbak: ERROR: gds_$get_segment failed
gbak: Exiting before completion due to errors
----------------
The problem internally is caused by the following piece of code:
------------ blb.cpp: BLB_get_segment --------------------------
/* If this is a stream blob, fake fragment unless we're at the end */
if (STREAM)
blob->blb_fragment_size =
(blob->blb_seek == blob->blb_length) ? 0 : 1;
----------------------------------------------------------------
and then
------------ jrd.cpp: GDS_GET_SEGMENT --------------------------
if (blob->blb_flags & BLB_eof) {
JRD_restore_context();
--dbb->dbb_use_count;
return (user_status[1] = isc_segstr_eof);
}
else if (blob->blb_fragment_size) {
JRD_restore_context();
--dbb->dbb_use_count;
return (user_status[1] = isc_segment);
}
----------------------------------------------------------------
i.e. isc_get_segment always returns "segment buffer length shorter
than expected" error when called for long stream blob.
I think that Jaybird should avoid using stream blobs when used against
Firebird 1.0 databases.
I think that returning success from isc_get_segment for partially read
stream blobs would be the correct solution for Firebird 1.5 and 2.0.
Suggestions ?
--
Best regards,
Nickolay Samofatov mailto:skidder@...