Commit Graph

54 Commits

Author SHA1 Message Date
Raphael Collet ea167ad7ab [IMP] test cursor: code cleanup to make it more robust to concurrent accesses
bzr revid: rco@openerp.com-20140414075906-2d0i4qhe4x7czsao
2014-04-14 09:59:06 +02:00
Raphael Collet d67e63150e [FIX] sql_db: forgotten attribute renaming _pool -> __pool
bzr revid: rco@openerp.com-20140410113950-71gcyz0t2rfuww57
2014-04-10 13:39:50 +02:00
Christophe Simonis 15680c94e1 [MERGE] forward port of branch saas-3 up to revid 5115 chs@openerp.com-20140410102422-fcwxhjk40z0oy8x5
bzr revid: chs@openerp.com-20140410105454-6utwgruj80h8wdss
2014-04-10 12:54:54 +02:00
Christophe Simonis 3d2e9b4d2b [MERGE] forward port of branch 7.0 up to revid 5281 launchpad_translations_on_behalf_of_openerp-20140412094159-mhy3v2prb3ctx32k
bzr revid: jke@openerp.com-20140409153527-mic1a8afcvdhsd27
bzr revid: chs@openerp.com-20140410102422-fcwxhjk40z0oy8x5
bzr revid: chs@openerp.com-20140415133650-y46i0o3qkb2atbvi
2014-04-15 15:36:50 +02:00
Kersten Jeremy 3285feab53 [FIX] Allow missing opcodes, harden check for private attributes (dunder), check inside embedded code objects.
bzr revid: jke@openerp.com-20140409151659-xwttchbtbj02v1w7
2014-04-09 17:16:59 +02:00
Raphael Collet 5640f3076a [MERGE] test_cursor: implement a cursor mockup that never commits to database, and use it for http tests
bzr revid: rco@openerp.com-20140409145830-rop8esgic2y435kf
2014-04-09 16:58:30 +02:00
Raphael Collet dda229273d [IMP] sql_db: simplify TestCursor, given that method execute() does not need overriding
bzr revid: rco@openerp.com-20140409130825-rnc9hqh9t16hqcaq
2014-04-09 15:08:25 +02:00
Raphael Collet fd8fd0906f [IMP] make TestCursor more robust, and remove some tests on tools.config['test_enable']
bzr revid: rco@openerp.com-20140409103337-r0a1nx9h8nfg3cn3
2014-04-09 12:33:37 +02:00
Raphael Collet e5e00e4c0a [IMP] registry: now cursor() simply returns a cursor, which may itself be used as a context manager
bzr revid: rco@openerp.com-20140409095604-joh9dt0qkma12ykm
2014-04-09 11:56:04 +02:00
Raphael Collet f0fd48c44a [IMP] http tests: implement a test cursor that keeps a transaction open accross requests
- TestCursor subclasses Cursor, and simulates commit and rollback with savepoints
 - the registry manages a test mode, in which it only uses the test cursor
 - a reentrant lock forces the serialization of parallel requests

bzr revid: rco@openerp.com-20140408151736-j0guy68i2wjexy3d
2014-04-08 17:17:36 +02:00
Antony Lesuisse 09deba4826 [FIX] tests dont generate traceback on aborted test requests
bzr revid: al@openerp.com-20140317124343-kgesa5c215z19vpn
2014-03-17 13:43:43 +01:00
Xavier Morel bc86fdc614 [IMP] Cursor.savepoint
time.time doesn't guarantee sub-second precision.

Use a uuid1 instead (lower anonymity but higher isolation than uuid4
especially in distributed systems, and we don't care about anonimity for
savepoint names from application servers).

Quote name so first character can be a digit.

bzr revid: xmo@openerp.com-20140220103345-xistzxy17r8j87hf
2014-02-20 11:33:45 +01:00
Christophe Simonis d60cf404ca [FIX] orm._auto_init: fallback to copy method when altering in-place varchar columns failed.
When a varchar column has a dependence on a view, we cannot change the size in-place,
we need to manually re-create the column with the correct type.

bzr revid: chs@openerp.com-20140217182045-qor70r3gb0fch2ki
2014-02-17 19:20:45 +01:00
Antony Lesuisse 9248a2db18 [FIX] multiprocess mode, empty the cursor pool before forking
bzr revid: al@openerp.com-20140122221525-hify023pk5i8d0jm
2014-01-22 23:15:25 +01:00
Vo Minh Thu 307ca374d6 [MERGE] forward merge 7.0 until revision 4919.
bzr revid: vmt@openerp.com-20130404130704-24vsmczw34cssytd
2013-04-04 15:07:04 +02:00
Vo Minh Thu 1e7e2ca753 [REF] no longer use openerp.pooler.
Either use openerp.modules.registry.RegistryManager when the full
new() signature is needed, or use openerp.registry().

Replaced also some pool.get() with pool[] because KeyErrors
are better than AttributeErrors on None.

bzr revid: vmt@openerp.com-20130327111014-2i0hlvpy5y5ku7hm
2013-03-27 12:10:14 +01:00
Vo Minh Thu c99c4091ce [REM] Deleted .apidoc lines.
They were probably used by some tools. How sad.

bzr revid: vmt@openerp.com-20130212142410-zqdjd8jw3gtvxab0
2013-02-12 15:24:10 +01:00
Olivier Dony db81edc287 [FIX] *: fix/rationalize db logging to avoid incorrect values during logging
The setting/clearing of the tracking were not done
consistently, causing log messages that appeared
to come from one database while coming from another
one or none at all.

The tracker is now set at the earliest points
of request handling where we can:
- in web client, when creating WebRequests (dbname, uid)
- at RPC dispatching in server (uid)
- at cron job acquisition in CronWorker (dbname)
- at Registry acquisition in RegistryManager (dbname)


The tracker is cleared at the very entrance of
the request in the WSGI `application`, ensuring
that no logging is produced with an obsolete
db name. (It cannot be cleared at the end of
the request handling because the werkzeug
wrapper outputs more logging afterwards)

bzr revid: odo@openerp.com-20130301120744-jfitcmze2jldecod
2013-03-01 13:07:44 +01:00
Olivier Dony 0240416a13 [REVERT] sql_db: undo eager removal of connections from pool; could skip half the connections and is not strictly required
Credit to Florent Xicluna for spotting it!

lp bug: https://launchpad.net/bugs/905257 fixed

bzr revid: odo@openerp.com-20130219102610-ll69qaf3zxem1pxf
2013-02-19 11:26:10 +01:00
Olivier Dony bbb4f105dc [FIX] sql_db: immediately remove the connections from the pool when detected to be dead
lp bug: https://launchpad.net/bugs/905257 fixed

bzr revid: odo@openerp.com-20130216011831-5ehi02j5nj6shh8n
2013-02-16 02:18:31 +01:00
Olivier Dony 547372ef94 [FIX] sql_db: only perform the connection reset when actually planning to borrow that connection, not before, for obvious performance reasons
bzr revid: odo@openerp.com-20130215161025-mjgmlju3zgs50zk7
2013-02-15 17:10:25 +01:00
Olivier Dony 979c28d0c9 [FIX] sql_db: typo in previous patch for autodetection of closed connections
My bad, I did and undid this patch several times
in different manners and ended up commiting the
wrong one.

lp bug: https://launchpad.net/bugs/905257 fixed

bzr revid: odo@openerp.com-20130215151237-3ks21kfhjb2fvl2z
2013-02-15 16:12:37 +01:00
Olivier Dony e464e1231d [FIX] sql_db: closing a closed connection is not allowed in psycopg2 2.4.4 and earlier
Having the connections automatically reaped by
psycopg2 is not guaranteed to happen all the
time, so we still need to take extra steps
to forece-close them

bzr revid: odo@openerp.com-20130215113751-12kwmfynyt43qs57
2013-02-15 12:37:51 +01:00
Christophe Simonis 94715ccbec [FIX] sql_db: free dead database connections
lp bug: https://launchpad.net/bugs/905257 fixed

bzr revid: chs@openerp.com-20130214135227-x6lzy3gj0s75ssmw
2013-02-14 14:52:27 +01:00
Xavier Morel b6ece5d65f [REM] trailing semicolons
bzr revid: xmo@openerp.com-20121214124310-wfdkhmcwxnyqu30m
2012-12-14 13:43:10 +01:00
Xavier Morel 90a687ab7a [FIX] misplaced docstrings
bzr revid: xmo@openerp.com-20121214124243-kvg2cg00k0a4518p
2012-12-14 13:42:43 +01:00
Xavier Morel c6079dd6bb [REM] unnecessary parens
bzr revid: xmo@openerp.com-20121214123803-6xu2s1ndnoyj4i3e
2012-12-14 13:38:03 +01:00
Raphael Collet 11051f32e0 [FIX] res_users.login: fix query parameters in cr.execute
bzr revid: rco@openerp.com-20121015100148-pkanx35vr6fqojuj
2012-10-15 12:01:48 +02:00
Xavier Morel b4421c8fba [ADD] cache dict on the cursor, for request-local repeated reads
bzr revid: xmo@openerp.com-20120924101404-cel6oy1akabbo7id
2012-09-24 12:14:04 +02:00
Vo Minh Thu 23eb63f139 [MERGE] merged trunk.
bzr revid: vmt@openerp.com-20120206203151-3snkz7usngwtv1xt
2012-02-06 21:31:51 +01:00
Vo Minh Thu 1ab6f8883c [IMP] logging: _logger.warn() replaced by _logger.warning().
bzr revid: vmt@openerp.com-20120202092634-pylu3098p5c0mays
2012-02-02 10:26:34 +01:00
Vo Minh Thu 5341b5f445 [IMP] logging: _logger.log(DEBUG) replaced by _logger.debug().
bzr revid: vmt@openerp.com-20120202092105-mfufuv97h8zrc2n7
2012-02-02 10:21:05 +01:00
Antony Lesuisse 936ce97689 fix --log-sql
bzr revid: al@openerp.com-20120201002321-nstmlzxzrcfgev13
2012-02-01 01:23:21 +01:00
Ronald Portier 64773ba357 [FIX] drop database fails when done before connecting to server.
lp bug: https://launchpad.net/bugs/924783 fixed

bzr revid: ronald@therp.nl-20120201113759-wi2kogl2x1lsxk7g
2012-02-01 12:37:59 +01:00
Vo Minh Thu 283304f9a2 [IMP] warnings: turn warnings.warn into logging.warning:
Warnings are handled with the other logs (and not always sent to stderr),
they also appear under a module __name__ channel instead of py.warn.
The disadvantage is that there is no longer specific warnings,
such as pending deprecation warning or deprecation warning.

bzr revid: vmt@openerp.com-20120125132407-u33idc0qh7ecs1i5
2012-01-25 14:24:07 +01:00
Vo Minh Thu eadcdd1fd6 [IMP] openerp.wsgi: _logger with fully qualified module name.
bzr revid: vmt@openerp.com-20120124111438-730miqdcm3eljgds
2012-01-24 12:14:38 +01:00
Vo Minh Thu 418739cf3e [MERGE] cleaned some imports, removed some code for older python versions.
bzr revid: vmt@openerp.com-20120118160305-ucennaoqehjuut1z
2012-01-18 17:03:05 +01:00
Vo Minh Thu b5caa70b83 [IMP] tools: removed some functools functions (they were there for previous python versions).
bzr revid: vmt@openerp.com-20120118114109-txh1cjv503xautty
2012-01-18 12:41:09 +01:00
nicolas.bessi@camptocamp.com 8d826cc07d [IMP] database template in commande line, you can now use --db_template=my_template, default is template0
bzr revid: nicolas.bessi@camptocamp.com-20120117164940-i3g1zcu49x0g60t5
2012-01-17 17:49:40 +01:00
Florent Xicluna 40c1de87d8 [REF] remove unused import, always import literal_eval from tools.safe_eval.
bzr revid: florent.xicluna@gmail.com-20120115214214-0rjwn80choc9g0fs
2012-01-15 22:42:14 +01:00
Florent Xicluna 1156aee52a [FIX] discard closed connections. Restart not required anymore when connection is lost.
bzr revid: florent.xicluna@wingo.ch-20111117093335-6t16181mqt49z7bi
2011-11-17 10:33:35 +01:00
Olivier Dony e7601e68cb [MERGE] sync with latest trunk
bzr revid: odo@openerp.com-20110928211326-0e51q7zlw4h2528z
2011-09-28 23:13:26 +02:00
Olivier Dony e85f246469 [IMP] sql_db: auto-exception-logging can now be turned off per cursor, not only per query
bzr revid: odo@openerp.com-20110924015852-9vru7cdsmzbvault
2011-09-24 03:58:52 +02:00
Vo Minh Thu ad06d1ba56 [FIX] This complements commit 3511,
revision-id: odo@openerp.com-20110714105552-9tgofrjtdgjmgc4b.
Each OpenERP cursor is mapped to a single psycopg2 connexion.
When a cursor is closed, the connexion is pushed back to a
pool and reused later. Now that the 'snapshot isolation' level
is used, the fact we didn't properly commit/rollback a
transaction appears: some 'concurrent' update showed up.
The fix is simple: whenever a cursor is closed, we rollback
any pending operation (which is the expected behavior).
(Furthermore, the connexion is explicitely closed when the
connexion is pushed back but not kept in the pool.)

bzr revid: vmt@openerp.com-20110913143444-s49r7r2h6m00p5s3
2011-09-13 16:34:44 +02:00
Vo Minh Thu 6fdadb04f5 [IMP] tools.cache: added missing clean_caches_for_db replacement.
bzr revid: vmt@openerp.com-20110825124711-y2uckmvcoa0arz4h
2011-08-25 14:47:11 +02:00
Olivier Dony 8504e6158b [IMP] sql_db: default cursor = serialized, deprecate serialized_cursor, add doc
In the context of OpenERP transaction, we really need the
'snapshot isolation' level provided by PostgreSQL because
not being able to make repeatable reads within the same
transaction is a very dangerous source of corrupted data,
especially in a very concurrent system.
The performance impact of switching from the default
read_committed level to serializable/repeatable_read level
has been measured and and was not distinguishable from 
the standard deviation - so it seems quite acceptable.
User of PostgreSQL 9.1 might want to update to psycopg2
version 2.4.2 or later to properly use the regular 
snapshot isolation level, and not the newer, more
expensive serializable level (see comments in Cursor
docstring).

bzr revid: odo@openerp.com-20110714105552-9tgofrjtdgjmgc4b
2011-07-14 12:55:52 +02:00
Vo Minh Thu b5daffc115 [IMP] registry: whene deleting a registry, also delete its cache and cron.
bzr revid: vmt@openerp.com-20110713153521-isn9bllnggbxwi0z
2011-07-13 17:35:21 +02:00
P. Christeas cf6e623f7d API docs: settings file and titles at modules
bzr revid: xrg@linux.gr-20110623090357-nazly8vpfnw0iskr
2011-06-23 12:03:57 +03:00
P. Christeas 588552b52d sql_db: docstrings
bzr revid: xrg@linux.gr-20110623090312-afwjqqduqdtex017
2011-06-23 12:03:12 +03:00
Vo Minh Thu 2856d16912 [ADD] sql_db: show file/line where the cursor was closed
This will be printed along the error message whenever an attempt to use
a closed cursor is made (only in debug_sql log level).

bzr revid: vmt@openerp.com-20110422112417-dbeqq4qm59sr2wvt
2011-04-22 13:24:17 +02:00