Bug 322552 - Provide a callback which informs about replication progress
Summary: Provide a callback which informs about replication progress
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.0   Edit
Hardware: PC All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Eike Stepper CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard: Power to the People
Keywords: noteworthy
Depends on:
Blocks:
 
Reported: 2010-08-12 11:39 EDT by Erwin Betschart CLA
Modified: 2011-06-23 03:41 EDT (History)
2 users (show)

See Also:


Attachments
Patch v1 - for future reference (85.83 KB, patch)
2010-08-15 05:02 EDT, Eike Stepper CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Erwin Betschart CLA 2010-08-12 11:39:48 EDT
Build Identifier: 4.0

A replication from a synchronizable repository may take a long time (even if raw replication is enabled).

It would be nice to have a indication that the sync is ongoing and how much is already replicated.
This indication could be one of the following:
-> Bytes transferred
-> Number of object types already synchronized
-> ?

Reproducible: Always
Comment 1 Eike Stepper CLA 2010-08-13 06:38:54 EDT
> It would be nice to have a indication that the sync is ongoing and how much is
> already replicated.

Where would you like to receive these indications, on the master repository, the master clients, the clone repository or the clone clients?

> This indication could be one of the following:
> -> Bytes transferred

That's hardly possible ;-(

> -> Number of object types already synchronized

That's next to impossible for raw replication.

> -> ?

I'd suggest to just inform about the progress in form of percentage numbers. Okay?
Comment 2 Eike Stepper CLA 2010-08-15 01:38:30 EDT
Starting to implement in-process notification from the clone repository to registered listeners...

Later we may consider to make progress notification available to clients of the clone.
Comment 3 Erwin Betschart CLA 2010-08-15 03:47:03 EDT
(In reply to comment #2)
> Starting to implement in-process notification from the clone repository to
> registered listeners...
> 
> Later we may consider to make progress notification available to clients of the
> clone.

That's exactly what I wanted ;-)
Comment 4 Eike Stepper CLA 2010-08-15 04:36:28 EDT
Progress monitoring makes everything so ugly. Always ;-(
Comment 5 Eike Stepper CLA 2010-08-15 05:02:57 EDT
Created attachment 176610 [details]
Patch v1 - for future reference
Comment 6 Eike Stepper CLA 2010-08-15 05:03:22 EDT
You can now register a progress listener as follows:

    clone.getSynchronizer().addListener(new IListener()
    {
      @Override
      public void notifyEvent(IEvent event)
      {
        if (event instanceof ProgressEvent)
        {
          ProgressEvent e = (ProgressEvent)event;
          int workPercent = (int)e.getWorkPercent();
          msg(e.getTask() + ": " + workPercent + "%");
        }
      }
    });

Please note that it's next to impossible to evenly distribute the progress for all possible cases of modification during OFFLINE. I've tried to make it as concise as possible for the average case.

Committed to HEAD.
Comment 7 Eike Stepper CLA 2010-08-15 11:51:48 EDT
I forgot to mention one thing:

With little (and no real-life) data it's hard to judge whether the progress distribution is good, feels good, etc.

IIRC even the distribution between java.sql.Statement.addBatch() and executeBatch() is driver-dependent and can easily proof assumptions wrong.

If you feel that it could be done differently/better, please reopen...
Comment 8 Erwin Betschart CLA 2010-08-16 04:40:12 EDT
(In reply to comment #1)
> > It would be nice to have a indication that the sync is ongoing and how much is
> > already replicated.
> 
> Where would you like to receive these indications, on the master repository,
> the master clients, the clone repository or the clone clients?
> 
> > This indication could be one of the following:
> > -> Bytes transferred
> 
> That's hardly possible ;-(

I'll try to achieve this with a stream wrapper.
Comment 9 Eike Stepper CLA 2011-06-23 03:41:40 EDT
Available in R20110608-1407