Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(16888)

Issue 9789044: code review 9789044: database/sql: Add SetMaxOpenConns() (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 11 months ago by Tad Glines
Modified:
10 years, 7 months ago
Reviewers:
bradfitz, julienschmidt, ioe
CC:
golang-dev
Visibility:
Public.

Description

database/sql: Add SetMaxOpenConns() Add the ability to set an open connection limit. Fixed case where the Conn finalCloser was being called with db.mu locked. Added seperate benchmarks for each path for Exec and Query.

Patch Set 1 #

Patch Set 2 : diff -r ca166884c853 https://code.google.com/p/go #

Total comments: 14

Patch Set 3 : diff -r 71375a634b9a https://code.google.com/p/go #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+646 lines, -20 lines) Patch
M src/pkg/database/sql/fakedb_test.go View 1 2 4 chunks +23 lines, -5 lines 0 comments Download
M src/pkg/database/sql/sql.go View 1 2 11 chunks +74 lines, -11 lines 5 comments Download
M src/pkg/database/sql/sql_test.go View 1 5 chunks +549 lines, -4 lines 0 comments Download

Messages

Total messages: 9
Tad Glines
Regarding the change to DB.Close(): This was the one place where the conn's finalClose() was ...
10 years, 11 months ago (2013-05-26 17:12:06 UTC) #1
bradfitz
https://codereview.appspot.com/9789044/diff/2001/src/pkg/database/sql/fakedb_test.go File src/pkg/database/sql/fakedb_test.go (right): https://codereview.appspot.com/9789044/diff/2001/src/pkg/database/sql/fakedb_test.go#newcode503 src/pkg/database/sql/fakedb_test.go:503: case "NOSERT": what is NOSERT? or execInsert's doInsert bool? ...
10 years, 10 months ago (2013-06-14 19:46:33 UTC) #2
Tad Glines
Update to CL that addresses some comments to follow shortly. https://codereview.appspot.com/9789044/diff/2001/src/pkg/database/sql/sql.go File src/pkg/database/sql/sql.go (right): https://codereview.appspot.com/9789044/diff/2001/src/pkg/database/sql/sql.go#newcode196 ...
10 years, 10 months ago (2013-06-14 21:12:00 UTC) #3
Tad Glines
Hello google@julienschmidt.com, bradfitz@golang.org (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go
10 years, 10 months ago (2013-06-14 21:13:27 UTC) #4
Tad Glines
https://codereview.appspot.com/9789044/diff/2001/src/pkg/database/sql/fakedb_test.go File src/pkg/database/sql/fakedb_test.go (right): https://codereview.appspot.com/9789044/diff/2001/src/pkg/database/sql/fakedb_test.go#newcode503 src/pkg/database/sql/fakedb_test.go:503: case "NOSERT": On 2013/06/14 19:46:33, bradfitz wrote: > what ...
10 years, 10 months ago (2013-06-14 21:17:31 UTC) #5
ioe
On 2013/06/14 21:17:31, Tad Glines wrote: > NOSERT does everything INSERT does except it doesn't ...
10 years, 10 months ago (2013-06-14 23:02:32 UTC) #6
Tad Glines
On 2013/06/14 23:02:32, ioe wrote: > On 2013/06/14 21:17:31, Tad Glines wrote: > > NOSERT ...
10 years, 10 months ago (2013-06-14 23:49:48 UTC) #7
bradfitz
https://codereview.appspot.com/9789044/diff/9001/src/pkg/database/sql/sql.go File src/pkg/database/sql/sql.go (right): https://codereview.appspot.com/9789044/diff/9001/src/pkg/database/sql/sql.go#newcode196 src/pkg/database/sql/sql.go:196: cond sync.Cond I didn't really don't want to see ...
10 years, 9 months ago (2013-06-27 17:40:38 UTC) #8
Tad Glines
10 years, 9 months ago (2013-06-27 18:16:07 UTC) #9
https://codereview.appspot.com/9789044/diff/9001/src/pkg/database/sql/sql.go
File src/pkg/database/sql/sql.go (right):

https://codereview.appspot.com/9789044/diff/9001/src/pkg/database/sql/sql.go#...
src/pkg/database/sql/sql.go:196: cond     sync.Cond
On 2013/06/27 17:40:38, bradfitz wrote:
> I didn't really don't want to see a sync.Cond in this code.  The usage in this
> CL seems mostly fine (see comment below), but it adds complexity to code that
is
> arguably already borderline too complex.  I'd much prefer something using
> higher-level idiomatic Go mechanisms.
> 
> That is, can we make this code simpler at the same time?
> 
> I'd fine introducing new (unexported) types and interfaces and spilling out
into
> a new file if necessary, if all the pieces are clear.
> 
> Or not going that far, what does this CL look like mostly as-is, but without
the
> sync.Cond?
> 
> Can we have a connection manager goroutine (run for the life of the life of
the
> *DB) that owns the pool and hands out connections and counts?
> 

My original goals when writing this Cl where:
1. Minimize delta size (lines changed/added)
2. Zero (or nearly zero) impact to existing performance characteristics.

If neither of those are important, then yes, a channel base solution is
certainly possible. I did it once already, I can do it again :-)

I'll create a new CL with a channel based solution.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b