Subject | Re: [firebird-support] Service restore from stdin |
---|---|
Author | Pavel Cisar |
Post date | 2017-10-04T09:42:08Z |
Hi,
You can't use isc_info_svc_line for sending backup file to the service.
The right token is isc_info_svc_stdin. However, you have to send
isc_info_svc_line request along with it to get output from service to
detect that restore finished (value zero for reply to isc_info_svc_stdin
is just a signal that no stdin input is needed right now).
The reason why isc_info_svc_to_eof doesn't works here is IMHO because
this token returns after output buffer is full, not when any further
output is available like isc_info_svc_line (because output is always
produced in form of lines).
Restore via service using stdin is kind of a hack implementation that
require client to mix up two parallel "conversations" in single message
exchange loop: a) handling service request for stdin input b) service
stdout output because it's the only way how client can detect that the
restore finished (hence the need for isc_spb_verbose in restore
request). Until stdin is fully transmited service may need another
chunk, but reply to application is blocked until stdout buffer (eof
request) is full, so everything gets stuck (service will not ask for
further input because there is not enough output to send the request).
isc_info_svc_to_eof *may* work once whole backup stream is sent to the
service, so only stdout output is is service's reply (stdin reply is
zero), but there is no need to complicate the implementation at client
side to handle both output methods.
You may take a look at local_restore() implementation in FDB driver v1.8.
best regards
Pavel Cisar
IBPhoenix
Dne 3.10.2017 v 16:30 Dimitry Sibiryakov sd@...
[firebird-support] napsal(a):
You can't use isc_info_svc_line for sending backup file to the service.
The right token is isc_info_svc_stdin. However, you have to send
isc_info_svc_line request along with it to get output from service to
detect that restore finished (value zero for reply to isc_info_svc_stdin
is just a signal that no stdin input is needed right now).
The reason why isc_info_svc_to_eof doesn't works here is IMHO because
this token returns after output buffer is full, not when any further
output is available like isc_info_svc_line (because output is always
produced in form of lines).
Restore via service using stdin is kind of a hack implementation that
require client to mix up two parallel "conversations" in single message
exchange loop: a) handling service request for stdin input b) service
stdout output because it's the only way how client can detect that the
restore finished (hence the need for isc_spb_verbose in restore
request). Until stdin is fully transmited service may need another
chunk, but reply to application is blocked until stdout buffer (eof
request) is full, so everything gets stuck (service will not ask for
further input because there is not enough output to send the request).
isc_info_svc_to_eof *may* work once whole backup stream is sent to the
service, so only stdout output is is service's reply (stdin reply is
zero), but there is no need to complicate the implementation at client
side to handle both output methods.
You may take a look at local_restore() implementation in FDB driver v1.8.
best regards
Pavel Cisar
IBPhoenix
Dne 3.10.2017 v 16:30 Dimitry Sibiryakov sd@...
[firebird-support] napsal(a):
> Hello.
>
> When I use isc_info_svc_line for sending a piece of backup to server, everything works
> well. But when I use just replace isc_info_svc_line with isc_info_svc_to_eof, no errors is
> produced, but database is not restored.
> Do I something wrong or it is a bug (incomplete implementation)?
>