Commit Graph

8 Commits

Author SHA1 Message Date
Barış Soner Uşaklı
0524fd9caa closes #6996 (#6997)
* closes #6996

* fix lint
2018-11-24 23:02:22 -05:00
Barış Soner Uşaklı
0aebb9caf8 closes #6844 2018-10-16 20:27:14 -04:00
Ben Lubar
11b655163e Only run the DDL for session storage on the primary instance. (#6788)
This fixes a restart loop caused by deadlocks in large clusters.
2018-09-25 12:12:18 -04:00
Ben Lubar
97a3079bc0 Optimize PostgreSQL session store.
- Sets session ID to be a constant-sized character field inline in the
  table instead of a variable-length character field compressed outside
  of the row.
- Changes the session data from "json" to "jsonb" which is faster and
  smaller on disk with the drawback of not maintaining key order and
  whitespace (which we don't care about at all)
- Adds a clustered index on the session expiration timestamp, which will
  make periodic session purging much faster.

(For an example, WTDWTF currently has 482355 sessions in the table, and
 because there is no index on the expiration timestamp, PostgreSQL must
 check all the rows in the table every time.)

This upgrade script can run concurrently with a live NodeBB instance,
but any action that touches sessions will wait until the upgrade script
is done.

Does not touch the database if the database driver is not set to
PostgreSQL or if there is a Redis database configured.
2018-09-02 00:32:55 -04:00
Barış Soner Uşaklı
0519f84734 Promisify modules (#6723)
* WIP promisify

* promisify psql

* ability to skip some keys

* dont promisify client object

* remove async

* clone entire module so it has all properties

* add shim for node 6

* ignore sessionStore as well

* ignore pool on psql
2018-08-31 11:04:42 -04:00
Ben Lubar
33228bb7fe PostgreSQL database driver (#5861)
* [test/database/list] Fix test list 4 being used in two different tests

* [database/postgres] PostgreSQL database driver

* [database/postgres] Make transactions work based on continuation scope.

* [database/postgres] Implement nested transactions

* eslint --fix

* Add database changes from earlier this week to the PostgreSQL driver.

* Fix typo

* Fix postgres.incrObjectFieldBy returning undefined instead of null when given NaN

* [database/postgres] Fix sortedSetsCard returning an array of strings.

* Update socket.io postgres adapter

* Fix PostgreSQL erroring when multiple updates are made to the same sorted set entry in a single operation.

Add a test case to catch this error.

* Fix lint errors.

* Only prune sessions on one instance in a cluster to avoid deadlocks.

They're caught and handled by the database server, but they spam the logs.

* Fix arguments.slice.
2018-08-08 15:13:48 -04:00
Julian Lam
4c70a0da4f removing postgres file from databases/ 2014-10-02 18:54:20 -04:00
Julian Lam
24ac7ba316 better templating and styling for #2099 2014-10-02 18:26:43 -04:00