Subject Re: [Firebird-Java] Are there plans for streaming backup support?
Author Ivan Arabadzhiev
Hi again,
My insomnia is getting the better of me and I now have a proof of concept at https://github.com/ls4f/jaybird/blob/streaming-br/src/main/org/firebirdsql/management/FBStreamingBackupManager.java . Haven't made a PR because it doesn't feel good enough yet, but it does backup and restore successfully at x86_64 linux with fb 2.5.4(which means it should be less work than I initially thought).
I have a 25GB db to play with after  sunrise, and I will try to test on 32/64 Windows/Linux this week but :
1 Are we ok with the 'hack' I'm using for backing up with by temporarily changing the logger? Now that I have some idea what exactly is happening, I think doing a backup like that should be ok even with my earlier idea and currently released Jaybird.
2 Are we ok with some code being duplicated in the new class? I suppose FBServiceManager  could be reworked so all the handling remains in it, but I'm not really sure it's worth it - right now there is just the new file and one other changed line.
3 Currently the implementation expects InputStream/OutputStream, which means no multi-fbk operations. I'm thinking that part could be left to the users to handle, but providing some default stream-like wrappers won't be that much more work to do, if it seems necessary.
4 I'm not sure if the change in ByteArrayArgument can cause any problems but if it does - how should I add the byte[] parameter for isc_info_svc_stdin?
5 Any other thoughts on the generic idea?

2016-01-16 16:55 GMT+02:00 Mark Rotteveel mark@... [Firebird-Java] <Firebird-Java@yahoogroups.com>:
 

On 16-1-2016 14:18, Ivan Arabadzhiev intelrullz@...
[Firebird-Java] wrote:
> First - thank you for the response, it's always better to now where
> things are at the moment.
> Yes, I have used .setLogger(), to be more precise :
>
> (with-open [r (clojure.java.io/output-stream
> <http://clojure.java.io/output-stream> "/tmp/sample.fbk")]
> (doto (org.firebirdsql.management.FBBackupManager.)
> (.setHost "127.0.0.1")
> (.setPort 3050)
> (.setUser "SYSDBA")
> (.setPassword "masterkey")
> (.setLogger r)
> (.setDatabase "/srv/firebird/rpk.fdb")
> (.setBackupPath "stdout")
> (.backupDatabase)))
>
> (currently I'm doing most JVM development on clojure but the code is
> simple enough to understand as is)

Thanks. I believe that in this case the stream should only contain the
backup information. So as far as I know the code above should indeed
work correctly, but as I haven't really looked into the streaming backup
functionality I am not entirely sure. Of course, for it to be feature
complete it would also need the streaming restore functionality ;)

> Obviously, haven't put it in production so I can't really say how
> reliable it is but I have tested it on windows/linux 32/64 bit so it
> might turn out to be a viable code path (possibly with a better
> interface to specify the output stream).

It looks like it would be. If it turns out to be simple enough, I might
even squeeze it into Jaybird 3.0.

> I have been meaning to port a .net backup tool I no longer want/can
> support over to the JVM and would prefer it to work without any external
> fb dependencies but it has been about an year so far so I'm not making
> promises on the PR :) If I do get to it - the agreement won't be a problem.

No problem. Contributions are always welcome, but I also understand time
constraints :).

Mark
--
Mark Rotteveel