Skip to content

distsqlrun: make txn mem mon own local flow's#26108

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
jordanlewis:local-flow-mon
May 29, 2018
Merged

distsqlrun: make txn mem mon own local flow's#26108
craig[bot] merged 1 commit intocockroachdb:masterfrom
jordanlewis:local-flow-mon

Conversation

@jordanlewis
Copy link
Copy Markdown
Member

@jordanlewis jordanlewis commented May 25, 2018

Previously, DistSQL flows that were local to the coordinator node used a
memory monitor that was owned by a generic distsql memory monitor. This
was misleading, as it prevented memory used by distsql local to a node
from showing up in the query's used memory.

Now, a query's transaction memory monitor is passed to the local distsql
flow created for it. The remote distsql flows still are monitored by the
generic distsql one, but this is a start at bettering the situation.

Closes #25879.

Release note: None

@jordanlewis jordanlewis requested review from a team and asubiotto May 25, 2018 20:26
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@rjnn
Copy link
Copy Markdown
Contributor

rjnn commented May 29, 2018

:lgtm: :shipit:


Review status: all files reviewed at latest revision, all discussions resolved, all commit checks successful.


Comments from Reviewable

@asubiotto
Copy link
Copy Markdown
Contributor

:lgtm:


Review status: all files reviewed at latest revision, all discussions resolved, all commit checks successful.


pkg/sql/distsqlplan/aggregator_funcs_test.go, line 71 at r1 (raw file):

	var rowBuf distsqlrun.RowBuffer

	ctx, flow, err := distSQLSrv.SetupSyncFlow(context.TODO(), distSQLSrv.ParentMemoryMonitor, &req, &rowBuf)

It's a bit confusing that you use ParentMemoryMonitor in this test but memMonitor in flow_registry_test. I believe the difference is that the first one is the root monitor and memMonitor is the distsql monitor created in NewServer. I would use memMonitor here and add a comment to ParentMemoryMonitor that it should only be used when setting up a server.


pkg/sql/distsqlrun/server.go, line 406 at r1 (raw file):

// Flow.Cleanup.
func (ds *ServerImpl) SetupSyncFlow(
	ctx context.Context, mon *mon.BytesMonitor, req *SetupFlowRequest, output RowReceiver,

nit: I would also call this parentMonitor to be clear


Comments from Reviewable

Previously, DistSQL flows that were local to the coordinator node used a
memory monitor that was owned by a generic distsql memory monitor. This
was misleading, as it prevented memory used by distsql local to a node
from showing up in the query's used memory.

Now, a query's transaction memory monitor is passed to the local distsql
flow created for it. The remote distsql flows still are monitored by the
generic distsql one, but this is a start at bettering the situation.

Release note: None
@jordanlewis
Copy link
Copy Markdown
Member Author

Review status: 3 of 4 files reviewed at latest revision, 2 unresolved discussions, all commit checks successful.


pkg/sql/distsqlplan/aggregator_funcs_test.go, line 71 at r1 (raw file):

Previously, asubiotto (Alfonso Subiotto Marqués) wrote…

It's a bit confusing that you use ParentMemoryMonitor in this test but memMonitor in flow_registry_test. I believe the difference is that the first one is the root monitor and memMonitor is the distsql monitor created in NewServer. I would use memMonitor here and add a comment to ParentMemoryMonitor that it should only be used when setting up a server.

Yeah... but this is in a different package, so you can't use the unexported memMonitor field :(

I'll add a comment to ParentMemoryMonitor though.


Comments from Reviewable

@jordanlewis
Copy link
Copy Markdown
Member Author

bors r+

craig bot pushed a commit that referenced this pull request May 29, 2018
26108: distsqlrun: make txn mem mon own local flow's r=jordanlewis a=jordanlewis

Previously, DistSQL flows that were local to the coordinator node used a
memory monitor that was owned by a generic distsql memory monitor. This
was misleading, as it prevented memory used by distsql local to a node
from showing up in the query's used memory.

Now, a query's transaction memory monitor is passed to the local distsql
flow created for it. The remote distsql flows still are monitored by the
generic distsql one, but this is a start at bettering the situation.

Closes #25879.

Release note: None

Co-authored-by: Jordan Lewis <jordanthelewis@gmail.com>
@craig
Copy link
Copy Markdown
Contributor

craig bot commented May 29, 2018

Build succeeded

@craig craig bot merged commit 5324674 into cockroachdb:master May 29, 2018
@jordanlewis jordanlewis deleted the local-flow-mon branch June 3, 2018 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants