This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 176513 - [api] add support for requesting multiple task data in single request
Summary: [api] add support for requesting multiple task data in single request
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P1 enhancement (vote)
Target Milestone: 2.0   Edit
Assignee: Robert Elves CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-06 12:35 EST by John Anvik CLA
Modified: 2007-06-21 17:37 EDT (History)
4 users (show)

See Also:


Attachments
Use single request patch (53.35 KB, text/plain)
2007-03-22 13:28 EDT, Robert Elves CLA
no flags Details
mylar/context/zip (14.79 KB, application/octet-stream)
2007-03-22 13:28 EDT, Robert Elves CLA
no flags Details
mylar/context/zip (14.91 KB, application/octet-stream)
2007-03-22 13:31 EDT, Robert Elves CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description John Anvik CLA 2007-03-06 12:35:54 EST
A complaint I have recieved by projects that I mine is the process of getting one bug at a time from the repository when I want a set of reports. This is also a performance issue for applications such as mine. Could you please add a method that takes in a list of report ids (such as returned by a search collector) and returns the RepositoryTaskData items? To make the repository admins happy the method would need to make a single call to the server (i.e. the method should not just loop over the report id list and call getTaskData(id) - I'm already doing that and the admins grumpy). Maybe a method looking like :

	client.getTaskData(List<String> reportIds);
Comment 1 Robert Elves CLA 2007-03-12 18:19:59 EDT
We could likely speed up a few operations (such as synchronization) if we just hit the search once per set of tasks rather one by one. It will require some changes to our api. I'll try to get to this for 2.0. At the least headless support could be added.
Comment 2 Robert Elves CLA 2007-03-12 18:28:32 EDT
Example Query: /show_bug.cgi?ctype=xml&id=23&id=24&id=25
Comment 3 Robert Elves CLA 2007-03-22 13:28:51 EDT
Created attachment 61708 [details]
Use single request patch

Use single request if supported.
Comment 4 Robert Elves CLA 2007-03-22 13:28:53 EDT
Created attachment 61709 [details]
mylar/context/zip
Comment 5 Robert Elves CLA 2007-03-22 13:31:37 EDT
Created attachment 61710 [details]
mylar/context/zip
Comment 6 Robert Elves CLA 2007-03-22 13:51:36 EDT
Mik, Eugene, you may want to have a look over suggested changes, specifically to SynchronizeQueryJob, SynchronizeTaskJob, and api in ITaskDataHandler. I didn't look into Jira or Track's ability to support single request for multiple task data. Still some error handling improvements required such as fail over to individual task download in case of exception during multi download in the two synch jobs.
Comment 7 Mik Kersten CLA 2007-03-22 13:59:08 EDT
I will not be able to review today, but feel free to point me at it in person tomorrow.
Comment 8 Robert Elves CLA 2007-03-26 20:30:37 EDT
Since my patch is getting stale I've committed the bugzilla client side support for this so that John can use it headless.  We can discuss the proposed changes to the tasks api during the next mylar conference call.

John, I've added Map<String, RepositoryTaskData> getTaskData(Set<String> taskIds) to BugzillaClient. Pass in a set of task ids and you'll get back a map of id -> taskdata.

Note to self: Enable unit test in BugzillaQueryTest once ITaskDataHandler api updated.
Comment 9 John Anvik CLA 2007-03-26 20:38:11 EDT
Great. Thanks.
Comment 10 Steffen Pingel CLA 2007-03-27 10:29:40 EDT
We should look into refactoring part of the synchronization API for 2.0M3. Trac and JIRA return the complete task information for each query result and not just the ids. With the current implementation this data is downloaded again when all changed tasks are synchronized. 

Eugene also suggested to add an option to always download task data for certain queries to support working offline. 
Comment 11 Eugene Kuleshov CLA 2007-03-27 12:14:29 EDT
(In reply to comment #10)
> Eugene also suggested to add an option to always download task data for certain
> queries to support working offline. 

Yea, that hit me really bad on my last trip. I don't know what Mylar is downloading, but I wasn't been able to open any new/incoming tasks for offline reviewing.
Comment 12 Shawn Minto CLA 2007-03-27 12:26:43 EDT
The connector that I am writing also returns the complete task information upon a query and therefore it is downloaded twice with the current implementation.  It would be nice if the data could be saved and not downloaded if the repository supports this.
Comment 13 Eugene Kuleshov CLA 2007-03-27 12:35:05 EDT
BTW, I should say that connector I write does the same. So, it seems like Bugzilla is nearly the only one that don't return complete task data.
Comment 14 Robert Elves CLA 2007-03-27 13:42:33 EDT
Will refactor api for M3 as per conference call. AbstractRepositoryConnector.performQuery() should update task data directly (rather than launching additional jobs to retrieve task data for each hit). In doing we can also address handling of synch timestamp (bug#176934).
Comment 15 Robert Elves CLA 2007-06-19 03:48:09 EDT
Committed first pass.  ITaskDataHandler now AbstractTaskDataHandler.  Added getTaskData method that takes a set of ids and returns a set of retrieved data. The only problem I see thus far is the inability to set error status on a per task bassis.
Comment 16 Steffen Pingel CLA 2007-06-19 11:56:26 EDT
The default implementation of AbstractTaskDataHandler.getTaskData() should not return null. It should iterate over the tasks and download the task data for each individual task or throw an OperationUnsupportedException().
Comment 17 Robert Elves CLA 2007-06-19 12:41:56 EDT
Yes, I considered both suggestions and unless we start passing the set of task objects to this new data handler method we can't set the error status on individual tasks. So for that reason I backed out and implemented as it is now.  I'll have another look today though with fresh eyes.
Comment 18 Steffen Pingel CLA 2007-06-19 12:52:36 EDT
I am not convinced that the new API is better for repositories that do not support fetching multiple tasks at once since it delays completing the synchronization for each task until the task data for all tasks has been downloaded. With the old API single tasks would complete as soon as the data became available. It also makes the API of AbstractTaskDataHandler more complicated. 

My suggestion is to add a AbstractTaskDataHandler.canGetMultiTaskData() method that returns false by default. SynchronizeTaskJob should use the old implementation that synchronized each task individually in that case and only use getMultiTaskData() when available.

I wouldn't worry about the error status too much and just set it on all tasks like it is done now.
Comment 19 Robert Elves CLA 2007-06-19 20:16:24 EDT
 (In reply to comment #18)
> I am not convinced that the new API is better for repositories that do not
> support fetching multiple tasks at once since it delays completing the
> synchronization for each task until the task data for all tasks has been
> downloaded. 
Yes, this bothers me too.

> My suggestion is to add a AbstractTaskDataHandler.canGetMultiTaskData() method
> that returns false by default. SynchronizeTaskJob should use the old
> implementation that synchronized each task individually in that case and only
> use getMultiTaskData() when available.
Done.
Comment 20 Steffen Pingel CLA 2007-06-19 21:29:23 EDT
Rob, please consider making AbstractTaskDataHandler.getMultiTaskData() throw UnsupportedOperationException by default. Having an API fail siliently can have funny effects.
Comment 21 Robert Elves CLA 2007-06-19 21:40:49 EDT
Done.
Comment 22 Robert Elves CLA 2007-06-20 12:48:16 EDT
Marking resolved.