Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Issue 308003009: Add ServerOperation and queue. (Closed)

Created:
6 years, 6 months ago by scheglov
Modified:
6 years, 6 months ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Add ServerOperation and queue. Schedule operations to perform analysis. Moving notifications into operations to be done in the next CL. R=brianwilkerson@google.com, paulberry@google.com BUG= Committed: https://code.google.com/p/dart/source/detail?r=36890

Patch Set 1 #

Patch Set 2 : Remove some priorities #

Total comments: 29

Patch Set 3 : Changes for review comments #

Total comments: 5

Patch Set 4 : Tweaks for review comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+407 lines, -486 lines) Patch
M pkg/analysis_server/lib/src/analysis_server.dart View 1 2 3 12 chunks +80 lines, -86 lines 0 comments Download
D pkg/analysis_server/lib/src/domain_context.dart View 1 chunk +0 lines, -193 lines 0 comments Download
A pkg/analysis_server/lib/src/operation/operation.dart View 1 2 1 chunk +73 lines, -0 lines 0 comments Download
A pkg/analysis_server/lib/src/operation/operation_queue.dart View 1 2 1 chunk +82 lines, -0 lines 0 comments Download
M pkg/analysis_server/lib/src/socket_server.dart View 2 chunks +0 lines, -2 lines 0 comments Download
M pkg/analysis_server/pubspec.yaml View 1 chunk +1 line, -0 lines 0 comments Download
M pkg/analysis_server/test/analysis_server_test.dart View 1 2 3 4 chunks +2 lines, -27 lines 0 comments Download
M pkg/analysis_server/test/domain_analysis_test.dart View 1 2 12 chunks +14 lines, -14 lines 0 comments Download
D pkg/analysis_server/test/domain_context_test.dart View 1 chunk +0 lines, -154 lines 0 comments Download
M pkg/analysis_server/test/mocks.dart View 1 2 2 chunks +3 lines, -3 lines 0 comments Download
A pkg/analysis_server/test/operation/operation_queue_test.dart View 1 2 1 chunk +122 lines, -0 lines 0 comments Download
A + pkg/analysis_server/test/operation/operation_test.dart View 1 1 chunk +9 lines, -5 lines 0 comments Download
A pkg/analysis_server/test/operation/test_all.dart View 1 chunk +19 lines, -0 lines 0 comments Download
M pkg/analysis_server/test/test_all.dart View 1 2 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 12 (0 generated)
scheglov
6 years, 6 months ago (2014-05-31 04:32:36 UTC) #1
Brian Wilkerson
I have some concerns about this CL (including the fact that it totally breaks the ...
6 years, 6 months ago (2014-06-02 14:32:18 UTC) #2
Paul Berry
https://codereview.chromium.org/308003009/diff/20001/pkg/analysis_server/lib/src/analysis_server.dart File pkg/analysis_server/lib/src/analysis_server.dart (left): https://codereview.chromium.org/308003009/diff/20001/pkg/analysis_server/lib/src/analysis_server.dart#oldcode111 pkg/analysis_server/lib/src/analysis_server.dart:111: * Invariant: when this list is non-empty, there is ...
6 years, 6 months ago (2014-06-02 16:04:41 UTC) #3
Brian Wilkerson
https://codereview.chromium.org/308003009/diff/20001/pkg/analysis_server/lib/src/operation/operation.dart File pkg/analysis_server/lib/src/operation/operation.dart (right): https://codereview.chromium.org/308003009/diff/20001/pkg/analysis_server/lib/src/operation/operation.dart#newcode22 pkg/analysis_server/lib/src/operation/operation.dart:22: static const ServerOperationPriority ANALYSIS_NOTIFICATION = const ServerOperationPriority._(0, "ANALYSIS_NOTIFICATION"); > ...
6 years, 6 months ago (2014-06-02 16:21:00 UTC) #4
Paul Berry
https://codereview.chromium.org/308003009/diff/20001/pkg/analysis_server/lib/src/operation/operation.dart File pkg/analysis_server/lib/src/operation/operation.dart (right): https://codereview.chromium.org/308003009/diff/20001/pkg/analysis_server/lib/src/operation/operation.dart#newcode22 pkg/analysis_server/lib/src/operation/operation.dart:22: static const ServerOperationPriority ANALYSIS_NOTIFICATION = const ServerOperationPriority._(0, "ANALYSIS_NOTIFICATION"); On ...
6 years, 6 months ago (2014-06-02 16:29:25 UTC) #5
Brian Wilkerson
https://codereview.chromium.org/308003009/diff/20001/pkg/analysis_server/lib/src/operation/operation.dart File pkg/analysis_server/lib/src/operation/operation.dart (right): https://codereview.chromium.org/308003009/diff/20001/pkg/analysis_server/lib/src/operation/operation.dart#newcode22 pkg/analysis_server/lib/src/operation/operation.dart:22: static const ServerOperationPriority ANALYSIS_NOTIFICATION = const ServerOperationPriority._(0, "ANALYSIS_NOTIFICATION"); > ...
6 years, 6 months ago (2014-06-02 16:42:33 UTC) #6
scheglov
https://codereview.chromium.org/308003009/diff/20001/pkg/analysis_server/lib/src/analysis_server.dart File pkg/analysis_server/lib/src/analysis_server.dart (left): https://codereview.chromium.org/308003009/diff/20001/pkg/analysis_server/lib/src/analysis_server.dart#oldcode111 pkg/analysis_server/lib/src/analysis_server.dart:111: * Invariant: when this list is non-empty, there is ...
6 years, 6 months ago (2014-06-02 17:56:59 UTC) #7
scheglov
PTAL
6 years, 6 months ago (2014-06-02 17:57:08 UTC) #8
Brian Wilkerson
LGTM https://codereview.chromium.org/308003009/diff/20001/pkg/analysis_server/lib/src/analysis_server.dart File pkg/analysis_server/lib/src/analysis_server.dart (right): https://codereview.chromium.org/308003009/diff/20001/pkg/analysis_server/lib/src/analysis_server.dart#newcode198 pkg/analysis_server/lib/src/analysis_server.dart:198: void internalPerformAnalysis(AnalysisContext context) { I'd like to start ...
6 years, 6 months ago (2014-06-02 18:21:02 UTC) #9
scheglov
Committed patchset #4 manually as r36890 (presubmit successful).
6 years, 6 months ago (2014-06-02 18:32:02 UTC) #10
scheglov
https://codereview.chromium.org/308003009/diff/20001/pkg/analysis_server/lib/src/analysis_server.dart File pkg/analysis_server/lib/src/analysis_server.dart (right): https://codereview.chromium.org/308003009/diff/20001/pkg/analysis_server/lib/src/analysis_server.dart#newcode214 pkg/analysis_server/lib/src/analysis_server.dart:214: schedulePerformAnalysisOperation(context, true); On 2014/06/02 18:21:03, Brian Wilkerson wrote: > ...
6 years, 6 months ago (2014-06-02 18:32:25 UTC) #11
Paul Berry
6 years, 6 months ago (2014-06-02 18:49:31 UTC) #12
Message was sent while issue was closed.
It looks like the CL got committed while I was drafting my follow-up comments,
so my comments may be moot.  Sending them anyway in case they are useful.

https://codereview.chromium.org/308003009/diff/20001/pkg/analysis_server/lib/...
File pkg/analysis_server/lib/src/operation/operation.dart (right):

https://codereview.chromium.org/308003009/diff/20001/pkg/analysis_server/lib/...
pkg/analysis_server/lib/src/operation/operation.dart:22: static const
ServerOperationPriority ANALYSIS_NOTIFICATION = const
ServerOperationPriority._(0, "ANALYSIS_NOTIFICATION");
On 2014/06/02 17:56:59, scheglov wrote:
> On 2014/06/02 16:42:33, Brian Wilkerson wrote:
> > > I would understand that if notifications weren't the highest priority type
> of
> > > task.  But since they are the highest priority type of task, that means
that
> > (a)
> > > the only requests whose latency we reduce are those that do not require
> doing
> > > any analysis,
> > 
> > True, which means that this might not be worthwhile.
> > 
> > > and (b) in practice we will never cancel any outdated
> > > notifications, since as soon as a set of notifications is generated, the
> > highest
> > > priority task will be to send them.
> > 
> > Here's the scenario I was thinking of:
> > 
> > 1. Server processes a request telling it that a file has changed.
> > 2. Server analyzes the file (after several iterations), and schedules a
> > notification.
> > 3. Server processes a request telling it that the same file has changed
again.
> > 4. The notification can be cancelled because the data it was depending on is
> > out-of-date.
> > 
> > It seems like a very small window of opportunity, and perhaps it would never
> buy
> > us any real advantage. Again, it might not be worth the complexity this
> > mechanism adds.
> > 
> > I'm happy to have it removed, and we can investigate solutions like this if
we
> > see a problem.
> 
> I will remove separate priorities for notifications for now.

Shoot, I think we've had some miscommunications.  I never meant to suggest
getting rid of "ANALYSIS_PRIORITY".  I meant to suggest getting rid of
"ANALYSIS_CONTINUE".

However, reading back through the code and my comments, I realize that I'd
misunderstood this code to be prioritizing analysis on a file-by-file basis, but
now I see that it's prioritizing analysis on a context-by-context basis.  That
changes things.

Now that I'm properly thinking about this code as operating on a
context-by-context basis, I'm not convinced that we want to do priorities this
way.  Effectively what we are saying is that we are going to first analyze all
contexts in round robin fashion.  Then when that's done we will do indexing
("search") for all contexts in round robin fashion.  Then when that's done we
will do refactoring for all contexts in round robin fashion.  That seems bad
because:

- By postponing indexing of context A until all other contexts have been
analyzed, we decrease the chances that the data we need for indexing is still in
the analysis cache, which means that indexing might do a lot of redundant work.

- By postponing refactoring of context A until all other contexts have been
analyzed and indexed, we penalize users who have a lot of contexts open.  If a
user requests a refactoring on context A, we really ought to focus on analyzing
and indexing context A so that we can get the refactoring done as soon as
possible--it should take priority over analyzing all other contexts.

This is making me think that maybe the only prioritization we want to do at this
point in the code is to make sure that (a) we fully operate on the priority
context (including search and refactoring) before doing operations on any other
contexts, and (b) as much as possible, we try to finish operating on one context
before moving on to the next (except when that conflicts with (a)).  Maybe
prioritization between analysis, search, and refactoring really belongs
exclusively within the context.

Powered by Google App Engine
This is Rietveld 408576698