dart_postgresql icon indicating copy to clipboard operation
dart_postgresql copied to clipboard

Version 0.3.0 published

Open xxgreg opened this issue 11 years ago • 10 comments

https://pub.dartlang.org/packages/postgresql

@tomyeh @pisabev @Fox32

Let me know if you have any issues.

Change log:

A new connection pool with more configuration options. Support for json and timestamptz types. Utc time zone support. User customisable type conversions. Improved error handling. Connection.onClosed has been removed. Some api has been renamed, the original names are still functional but marked as deprecated. Pool.destroy() => Pool.stop() The constants were upper case and int type. Now typed and lower camel case to match the style guide. Connection.unhandled => Connection.messages Connection.transactionStatus => Connection.transactionState

xxgreg avatar Dec 04 '14 09:12 xxgreg

I'm already using the 0.3.0 version from github since some days. Everything seems to work fine.

Btw. the readme still needs an update, especially the pooling part (take a look at the import comment at the beginning of the example)

Fox32 avatar Dec 04 '14 09:12 Fox32

Cool thanks for pointing that out.

Next time feel free to open an issue if you see something, or for the readme you can just edit it via the github web editor, and send a pull request.

I also updated the bit about type mappings.

Cheers.

xxgreg avatar Dec 04 '14 10:12 xxgreg

Sorry, I was busy. The new implementation looks great. Here is a few issues (It is a quick test. I might be wrong):

  1. Line 163, type_convert.dart: it shall be replaced with encodeString(value.toString()), since PostgreSQL expects a JSON string. Otherwise, it throws an exception: pgpool1:11048:3 ERROR 42804 column "value" is of type json but expression is of type integer
  2. maxConnections seems not working. I set minConnections to 10, and maxConnections to 200, but it rejects the connection after 10 with the following exception: pgpool1:null FATAL 53300 sorry, too many clients already

tomyeh avatar Jan 19 '15 05:01 tomyeh

Good timing. I've been away, and have just turned on my computer for the first time this year. Thanks for the feedback.

xxgreg avatar Jan 19 '15 07:01 xxgreg

@tomyeh

  1. Good catch - I need to add single quotes around the number. #57

  2. What is your max_connection set to in postgresql.conf? It sounds like you're hitting that limit. It's usually set to 100 by default.

xxgreg avatar Jan 21 '15 04:01 xxgreg

I set it to 200, but # of connections allowed depends only on minConnections. For instance, if 10-200, it stops at 10, and 15-200 stops at 15. It got no problem in the previous version.

_pool = new Pool(dbUri, minConnections: 10, maxConnections: 200,
    typeConverter: new _DBTypeConverter());

tomyeh avatar Jan 21 '15 04:01 tomyeh

Sure. I will look into it.

The error message you've quoted is what the database returns when max_connections is exhausted.

Btw in postgresql it is typical to only use ~2*cores number of connections in a pool, increasing it past this will likely reduce performance of the database due to increased contention.

On Wed, Jan 21, 2015 at 5:24 PM, Tom Yeh [email protected] wrote:

I set it to 200, but # of connections allowed depends only on minConnections. For instance, if 10-200, it stops at 10, and 15-200 stops at 15. It got no problem in the previous version.

— Reply to this email directly or view it on GitHub https://github.com/xxgreg/dart_postgresql/issues/54#issuecomment-70782650 .

xxgreg avatar Jan 21 '15 06:01 xxgreg

Regarding the pool issue, I created a new ticket #58.

xxgreg avatar Jan 21 '15 06:01 xxgreg

Thanks.

tomyeh avatar Jan 21 '15 09:01 tomyeh

I think, that task should be closed, shouldn't it?

artem-malko avatar Nov 20 '16 14:11 artem-malko