An error occurred fetching the project authors.
  1. 22 Sep, 2014 1 commit
  2. 08 Sep, 2014 1 commit
  3. 02 Sep, 2014 1 commit
    • Marko Tiikkaja's avatar
      database/sql: Avoid re-preparing statements when all connections are busy · 90e2e2b8
      Marko Tiikkaja authored
      Previously, if all connections were busy, we would always
      re-prepare the statement on the connection we were assigned from
      the pool.  That meant that if all connections were busy most of the
      time, the number of prepared statements for each connection would
      keep increasing over time.
      
      Instead, after getting a free connection, check to see if the
      statement has already been prepared on it, and reuse the statement
      handle if so.
      
      LGTM=bradfitz
      R=golang-codereviews, gobot, bradfitz
      CC=golang-codereviews
      https://golang.org/cl/116930043
      90e2e2b8
  4. 28 Aug, 2014 2 commits
    • Brad Fitzpatrick's avatar
      database/sql: use a value type instead of a pointer · 558bd8e1
      Brad Fitzpatrick authored
      Follow-up to https://golang.org/cl/107020044/
      Also add a little comment.
      
      LGTM=ruiu, josharian
      R=josharian, ruiu
      CC=golang-codereviews
      https://golang.org/cl/139760043
      558bd8e1
    • Alberto García Hierro's avatar
      database/sql: use slices rather than container/list · 6fb6f4e7
      Alberto García Hierro authored
      Significantly reduces the number of allocations, while also
      simplifying the code and increasing performance by a 1-2%.
      
      benchmark                          old ns/op     new ns/op     delta
      BenchmarkConcurrentDBExec          13290567      13026236      -1.99%
      BenchmarkConcurrentStmtQuery       13249399      13008879      -1.82%
      BenchmarkConcurrentStmtExec        8806237       8680182       -1.43%
      BenchmarkConcurrentTxQuery         13628379      12756293      -6.40%
      BenchmarkConcurrentTxExec          4794800       4722440       -1.51%
      BenchmarkConcurrentTxStmtQuery     5040804       5200721       +3.17%
      BenchmarkConcurrentTxStmtExec      1366574       1336626       -2.19%
      BenchmarkConcurrentRandom          11119120      10926113      -1.74%
      
      benchmark                          old allocs     new allocs     delta
      BenchmarkConcurrentDBExec          14191          13684          -3.57%
      BenchmarkConcurrentStmtQuery       16020          15514          -3.16%
      BenchmarkConcurrentStmtExec        4179           3672           -12.13%
      BenchmarkConcurrentTxQuery         16025          15518          -3.16%
      BenchmarkConcurrentTxExec          12717          12709          -0.06%
      BenchmarkConcurrentTxStmtQuery     15532          15525          -0.05%
      BenchmarkConcurrentTxStmtExec      2175           2168           -0.32%
      BenchmarkConcurrentRandom          12320          11997          -2.62%
      
      benchmark                          old bytes     new bytes     delta
      BenchmarkConcurrentDBExec          2164827       2139760       -1.16%
      BenchmarkConcurrentStmtQuery       2418070       2394030       -0.99%
      BenchmarkConcurrentStmtExec        1728782       1704371       -1.41%
      BenchmarkConcurrentTxQuery         2477144       2452620       -0.99%
      BenchmarkConcurrentTxExec          588920        588343        -0.10%
      BenchmarkConcurrentTxStmtQuery     790866        796578        +0.72%
      BenchmarkConcurrentTxStmtExec      98502         98143         -0.36%
      BenchmarkConcurrentRandom          1725906       1710220       -0.91%
      
      LGTM=ruiu, dave, bradfitz
      R=golang-codereviews, ruiu, gobot, bradfitz, dave, minux
      CC=bradfitz, golang-codereviews
      https://golang.org/cl/107020044
      6fb6f4e7
  5. 16 Jul, 2014 1 commit
  6. 19 May, 2014 1 commit
  7. 07 May, 2014 1 commit
  8. 29 Apr, 2014 1 commit
  9. 25 Mar, 2014 1 commit
  10. 27 Dec, 2013 1 commit
  11. 26 Dec, 2013 1 commit
  12. 17 Dec, 2013 2 commits
  13. 16 Dec, 2013 1 commit
    • Marko Tiikkaja's avatar
      database/sql: Check errors in QueryRow.Scan · 1f20ab11
      Marko Tiikkaja authored
      The previous coding did not correctly check for errors from the driver's
      Next() or Close(), which could mask genuine errors from the database, as
      witnessed in issue #6651.
      
      Even after this change errors from Close() will be ignored if the query
      returned no rows (as Rows.Next will have closed the handle already), but it
      is a lot easier for the drivers to guard against that.
      
      Fixes #6651.
      
      R=golang-dev, bradfitz
      CC=golang-dev
      https://golang.org/cl/41590043
      1f20ab11
  14. 10 Dec, 2013 1 commit
    • Alberto García Hierro's avatar
      database/sql: Remove redundant condition in if · c8869e9c
      Alberto García Hierro authored
      The final condition (db.maxIdleConnsLocked() > db.freeConn.Len()) can
      only be true iff db.maxIdleConnsLocked() is greater than 0, so previously
      checking if it's greater than 0 is a waste, specially when that involves
      a method call which (ATM) can't be inlined and includes a switch.
      
      Dissasembly follows (test for err == nil has been omitted for clarity):
      
      Before:
      43c357: cmp    $0x0,%bl
      43c35a: jne    43c3ce <database/sql.(*DB).putConnDBLocked+0x1ce>
      43c35c: mov    %rax,(%rsp)
      43c360: callq  43aec0 <database/sql.(*DB).maxIdleConnsLocked>
      43c365: mov    0x8(%rsp),%rbx
      43c36a: cmp    $0x0,%rbx
      43c36e: jle    43c3ce <database/sql.(*DB).putConnDBLocked+0x1ce>
      43c370: mov    0x30(%rsp),%rbx
      43c375: mov    %rbx,(%rsp)
      43c379: callq  43aec0 <database/sql.(*DB).maxIdleConnsLocked>
      43c37e: mov    0x30(%rsp),%rdx
      43c383: mov    0x8(%rsp),%rcx
      43c388: mov    0x28(%rdx),%rbp
      43c38c: mov    0x28(%rbp),%rbx
      43c390: cmp    %rcx,%rbx
      43c393: jge    43c3ce <database/sql.(*DB).putConnDBLocked+0x1ce>
      43c395: mov    0x28(%rdx),%rbp
      43c399: mov    %rbp,(%rsp)
      43c39d: mov    0x38(%rsp),%rcx
      43c3a2: mov    $0x556c60,%eax
      43c3a7: mov    %rax,0x8(%rsp)
      43c3ac: mov    %rcx,0x10(%rsp)
      43c3b1: callq  4db5b0 <container/list.(*List).PushFront>
      
      After:
      43c357: cmp    $0x0,%bl
      43c35a: jne    43c3b5 <database/sql.(*DB).putConnDBLocked+0x1b5>
      43c35c: mov    %rax,(%rsp)
      43c360: callq  43aec0 <database/sql.(*DB).maxIdleConnsLocked>
      43c365: mov    0x30(%rsp),%rdx
      43c36a: mov    0x8(%rsp),%rcx
      43c36f: mov    0x28(%rdx),%rbp
      43c373: mov    0x28(%rbp),%rbx
      43c377: cmp    %rcx,%rbx
      43c37a: jge    43c3b5 <database/sql.(*DB).putConnDBLocked+0x1b5>
      43c37c: mov    0x28(%rdx),%rbp
      43c380: mov    %rbp,(%rsp)
      43c384: mov    0x38(%rsp),%rcx
      43c389: mov    $0x556c60,%eax
      43c38e: mov    %rax,0x8(%rsp)
      43c393: mov    %rcx,0x10(%rsp)
      43c398: callq  4db590 <container/list.(*List).PushFront>
      
      R=golang-dev, bradfitz, iant
      CC=golang-dev
      https://golang.org/cl/14656044
      c8869e9c
  15. 30 Oct, 2013 1 commit
  16. 29 Oct, 2013 1 commit
  17. 24 Oct, 2013 1 commit
  18. 16 Oct, 2013 2 commits
  19. 30 Aug, 2013 3 commits
    • Tad Glines's avatar
      database/sql: add SetMaxOpenConns · 41c5d8d8
      Tad Glines authored
      Update #4805
      
      Add the ability to set an open connection limit.
      Fixed case where the Conn finalCloser was being called with db.mu locked.
      Added separate benchmarks for each path for Exec and Query.
      Replaced slice based idle pool with list based idle pool.
      
      R=bradfitz
      CC=golang-dev
      https://golang.org/cl/10726044
      41c5d8d8
    • Brad Fitzpatrick's avatar
      undo CL 10726044 / c9bea548fb6f · 9456adb3
      Brad Fitzpatrick authored
      Breaks build, and has a race.
      
      ««« original CL description
      database/sql: add SetMaxOpenConns
      
      Update #4805
      
      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.
      Replaced slice based idle pool with list based idle pool.
      
      R=bradfitz
      CC=golang-dev
      https://golang.org/cl/10726044
      
      »»»
      
      R=golang-dev
      CC=golang-dev
      https://golang.org/cl/13252046
      9456adb3
    • Tad Glines's avatar
      database/sql: add SetMaxOpenConns · 4572e484
      Tad Glines authored
      Update #4805
      
      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.
      Replaced slice based idle pool with list based idle pool.
      
      R=bradfitz
      CC=golang-dev
      https://golang.org/cl/10726044
      4572e484
  20. 16 Aug, 2013 1 commit
  21. 14 Aug, 2013 1 commit
  22. 13 Aug, 2013 1 commit
  23. 23 Jul, 2013 1 commit
  24. 21 May, 2013 1 commit
  25. 14 May, 2013 1 commit
  26. 06 May, 2013 1 commit
  27. 25 Apr, 2013 1 commit
    • Brad Fitzpatrick's avatar
      database/sql: fix driver Conn refcounting with prepared statements · 277047f5
      Brad Fitzpatrick authored
      The refcounting of driver Conns was completedly busted and
      would leak (be held open forever) with any reasonable
      load. This was a significant regression from Go 1.0.
      
      The core of this patch is removing one line:
      
           s.db.addDep(dc, s)
      
      A database conn (dc) is a resource that be re-created any time
      (but cached for speed) should not be held open forever with a
      dependency refcount just because the Stmt (s) is alive (which
      typically last for long periods of time, like forever).
      
      The meat of the patch is new tests. In fixing the real issue,
      a lot of tests then failed due to the fakedb_test.go's paranoia
      about closing a fakeConn while it has open fakeStmts on it. I
      could've ignored that, but that's been a problem in the past for
      other bugs.
      
      Instead, I now track per-Conn open statements and close them
      when the the conn closes.  The proper way to do this would've
      been making *driverStmt a finalCloser and using the dep mechanism,
      but it was much more invasive. Added a TODO instead.
      
      I'd like to give a way for drivers to opt-out of caring about
      driver.Stmt closes before a driver.Conn close, but that's a TODO
      for the future, and that TODO is added in this CL.
      
      I know this is very late for Go 1.1, but database/sql is
      currently nearly useless without this.
      
      I'd like to believe all these database/sql bugs in the past
      release cycle are the result of increased usage, number of
      drivers, and good feedback from increasingly-capable Go
      developers, and not the result of me sucking.  It's also hard
      with all the real drivers being out-of-tree, so I'm having to
      add more and more hooks to fakedb_test.go to simulate things
      which real drivers end up doing.
      
      Fixes #5323
      
      R=golang-dev, snaury, gwenn.kahz, google, r
      CC=golang-dev
      https://golang.org/cl/8836045
      277047f5
  28. 15 Apr, 2013 1 commit
    • Brad Fitzpatrick's avatar
      database/sql: close driver Stmt before releasing Conn · 36d3bef8
      Brad Fitzpatrick authored
      From the issue, which describes it as well as I could:
      
      database/sql assumes that driver.Stmt.Close does not need the
      connection.
      
      see database/sql/sql.go:1308:
      
      This puts the Rows' connection back into the idle pool, and
      then calls the driver.Stmt.Close method of the Stmt it belongs
      to.  In the postgresql driver implementation
      (https://github.com/lib/pq), Stmt.Close communicates with the
      server (on the connection that was just put back into the idle
      pool).  Most of the time, this causes no problems, but if
      another goroutine makes a query at the right (wrong?) time,
      chaos results.
      
      In any case, traffic is being sent on "free" connections
      shortly after they are freed, leading to race conditions that
      kill the driver code.
      
      Fixes #5283
      
      R=golang-dev, r
      CC=golang-dev
      https://golang.org/cl/8633044
      36d3bef8
  29. 03 Apr, 2013 1 commit
  30. 26 Mar, 2013 2 commits
  31. 25 Mar, 2013 1 commit
  32. 18 Mar, 2013 3 commits