Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 226618

Summary: [context] move task-specific editor memento storage out of the plug-in preference store
Product: z_Archived Reporter: Mik Kersten <mik.kersten>
Component: MylynAssignee: Steffen Pingel <steffen.pingel>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P2 CC: jtk499, manuel.doninger, mik.kersten, robert.munteanu, steffen.pingel, stepper, wim.jongman
Version: unspecifiedKeywords: plan
Target Milestone: 3.7   
Hardware: PC   
OS: Windows Vista   
Whiteboard:
Bug Depends on: 255923, 275899, 332697, 371984, 372432, 372553, 373186    
Bug Blocks:    
Attachments:
Description Flags
patch in progress
none
mylyn/context/zip
none
updated patch
none
next iteration
none
updated with new context listener framework
none
in progress
none
mylyn/context/zip
none
updated patch
none
next iteration none

Description Mik Kersten CLA 2008-04-10 22:40:18 EDT
We can currently bloat this store, which might be kept in memory.
Comment 1 Mik Kersten CLA 2008-04-10 22:45:20 EDT
Also remove coupling to Tasks in ContextEditorManager.
Comment 2 Mik Kersten CLA 2008-04-10 22:49:40 EDT
Also move ContextEditorManager to ..contex.ui.
Comment 3 Mik Kersten CLA 2008-05-29 14:43:35 EDT
Not critical, deferring to 3.1.
Comment 4 Mik Kersten CLA 2009-01-14 14:18:30 EST
Proposed design:
* Create an internal facility along the lines of ContextMementoManager.  This should probably be in ..context.ui.
* This will store a memento with all Workbench/UI state associated with the task.  Currently that's the editor mementos and the active perspective.  In the futrure it could also include editor splits (bug 171269).
* Won't be API for now, since everything that needs it is internal in ..context.ui, but could be API later.
* This hooks into AbstractContextListener, stores its state in the plug-in data location, not preferences, since we can get bloat with editor mementos.
* Need to migrate state from: .metadata\.plugins\org.eclipse.core.runtime\.settings
Comment 5 Steffen Pingel CLA 2009-01-20 01:10:57 EST
Created attachment 123033 [details]
patch in progress
Comment 6 Steffen Pingel CLA 2009-01-20 01:11:12 EST
Created attachment 123034 [details]
mylyn/context/zip
Comment 7 Steffen Pingel CLA 2009-01-20 02:32:30 EST
Created attachment 123040 [details]
updated patch
Comment 8 Steffen Pingel CLA 2009-01-20 18:40:33 EST
Created attachment 123142 [details]
next iteration
Comment 9 Shawn Minto CLA 2009-05-12 14:32:30 EDT
Created attachment 135417 [details]
updated with new context listener framework

I have updated this patch with the new context listener stuff and changes made to the ContextEditorManager.
Comment 10 Steffen Pingel CLA 2009-05-12 16:38:45 EDT
Remaining work:
* Test case
* Delete preferences after migration
* Ensure that lazy savings job completes before shutdown
* Clean-up code
Comment 11 Steffen Pingel CLA 2009-11-19 01:41:57 EST
Created attachment 152557 [details]
in progress
Comment 12 Steffen Pingel CLA 2009-11-19 01:42:02 EST
Created attachment 152558 [details]
mylyn/context/zip
Comment 13 Steffen Pingel CLA 2009-11-27 18:50:38 EST
As per discussion on conference call the mementos will be stored in workspace/.metadata/.mylyn/contexts/workspace
Comment 14 Steffen Pingel CLA 2009-12-02 15:06:52 EST
Created attachment 153653 [details]
updated patch
Comment 15 Steffen Pingel CLA 2009-12-11 01:25:04 EST
Created attachment 154288 [details]
next iteration

Todo:
* Test case for editor mementos
* Test case for URL refactoring
* Test case for cloning contexts
Comment 16 Steffen Pingel CLA 2010-02-04 21:07:15 EST
Also need to consider saving the context memento on shutdown. We may not either need to deactivate the active task or persist the state independently.
Comment 17 Jörg Thönnes CLA 2010-06-09 07:15:59 EDT
With regard to http://wiki.eclipse.org/Mylyn/FAQ#Why_does_startup_of_org.eclipse.mylyn.context.ui_take_so_long.3F
I wonder what is "large" in this context.

My file is about 2MByte -- is this large?

What happens if I delete it -- is it restored or do I loose some information?
Comment 18 Eike Stepper CLA 2010-06-09 07:35:12 EDT
(In reply to comment #17)
> I wonder what is "large" in this context.
> 
> My file is about 2MByte -- is this large?

Mine was 16MByte :P
Comment 19 Steffen Pingel CLA 2010-06-09 16:01:25 EDT
If the preferences file is deleted editors will not be restored on task activation. I would not worry too much about it. I guess that there was something funny about the file in Eike's case that was causing loading to be much slower than normal. I would not expect reading of 2 MB of preferences from disk to take longer than a second.
Comment 20 Steffen Pingel CLA 2011-09-22 08:06:44 EDT
Moving to backlog. Bug 338554 needs to be completed first.
Comment 21 Steffen Pingel CLA 2012-02-18 17:19:12 EST
I uploaded a review with proposed changes here: http://review.mylyn.org/#change,307.
Comment 22 Steffen Pingel CLA 2012-02-24 12:13:02 EST
The changes have been pushed to master. The editor and perspective state is now stored under <workspace>/.metadata/.plugins/.mylyn/tasks/<repository>/data/<task id>/. Automatic conversion code runs on first task activation and copies the content from <workspace>/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.mylyn.resources.ui.prefs to the new location. The old information in the preferences store is not deleted, yet, but I will enable that as soon as we are confident the new mechanism works.
Comment 23 Mik Kersten CLA 2012-02-24 12:25:56 EST
Steffen, do you want to wrap this in a job, or maybe pop up a dialog that it's going to happen?  While creating thousands of files here should be the exception, not the norm, I do wonder if for non-SSD machines we could end up with enough of a hang that people kill their Eclipse.
Comment 24 Steffen Pingel CLA 2012-02-24 12:30:24 EST
(In reply to comment #23)
> Steffen, do you want to wrap this in a job, or maybe pop up a dialog that it's
> going to happen?  While creating thousands of files here should be the
> exception, not the norm, I do wonder if for non-SSD machines we could end up
> with enough of a hang that people kill their Eclipse.

We could consider that. It's a one time migration though and I would like to see an indication of problem before taking action. It took less than 10 sec. on my machine and I think it's rare that users will have a comparably large store but if you see any significant problems please let me know.
Comment 25 Steffen Pingel CLA 2012-02-25 16:25:08 EST
I added a progress monitor since the migration can indeed take long enough to cause minor irritation.
Comment 26 Jörg Thönnes CLA 2012-02-27 03:04:15 EST
Steffen, moving this stuff onto disk should free memory and improve performance.

How much would be the performance improvement here? I am asking because some people
at my company always complaining about "bad performance" with Mylyn.

Thanks, Jörg
Comment 27 Steffen Pingel CLA 2012-02-27 06:11:42 EST
(In reply to comment #26)
> Steffen, moving this stuff onto disk should free memory and improve performance.

The memory saving depends on the size of the preference store which in turn depends on the number of editor mementos stored. If editor management is enabled a memento is stored for each task that is deactivated. On my system the store had accumulated 5 MB worth of editor mementos over the years.
 
> How much would be the performance improvement here? I am asking because some
> people
> at my company always complaining about "bad performance" with Mylyn.

In terms of performance the change should lower workbench startup time when the preference store was loaded into memory. It won't make a difference when working with the workbench.

We have a number of open bugs tagged as [performance] in the summary. Please comment on the bugs if any of the descriptions match what your colleagues are experiencing so we can prioritize accordingly or please file new bugs if you are seeing specific performance problems.
Comment 28 Sam Davis CLA 2012-02-27 20:54:11 EST
Steffen, every time I restart Eclipse, I am getting a progess dialog that says "Migrating context information" the first time I activate a task.
Comment 29 Steffen Pingel CLA 2012-02-28 02:48:56 EST
That's intended. The original data is not yet deleted (see comment 22).
Comment 30 Wim Jongman CLA 2013-05-23 06:45:35 EDT
I am getting the window "Migrating context information". I left it on all night but it does not go away. I forcefully ended my eclipse a few times but the window keeps popping up. There seems to be no disk activity.

We have our own connector that needs to connect to the database before any of the tasks can be read. I can see our login window but it is blocked because the "Migrating" window is modal. Could that have some meaning?

There is a Cancel button but that does nothing but grey out after pressing it.
Comment 31 Sam Davis CLA 2013-05-23 19:28:48 EDT
Steffen, it sounds like this could be a deadlock due to the migration waiting on the login prompt. Could we fix this just by making the dialog non-modal?