[source/native] finish removing reconnection logic

There is no reason we should try to reconnect sometimes, and not at other times.

Reconnection, if really wanted, will have to come with a different, likely more robust and lower-level way.

Related to #2919309.

authorAurelien Campeas <aurelien.campeas@logilab.fr>
changeseta203d1765901
branchdefault
phasedraft
hiddenyes
parent revision#480187dd66b3 [web] move AbstractAuthManager near its immediate concrete subclass
child revision<not specified>
files modified by this revision
server/sources/native.py
# HG changeset patch
# User Aurelien Campeas <aurelien.campeas@logilab.fr>
# Date 1402502635 -7200
# Wed Jun 11 18:03:55 2014 +0200
# Node ID a203d17659015b499d54f7ae2360f0ff86742d37
# Parent 480187dd66b3c5b0eebe922e9cba8d4f3a34efaa
[source/native] finish removing reconnection logic

There is no reason we should try to reconnect sometimes, and not at other times.

Reconnection, if really wanted, will have to come with a different,
likely more robust and lower-level way.

Related to #2919309.

diff --git a/server/sources/native.py b/server/sources/native.py
@@ -214,36 +214,16 @@
1          # deadlock on self._eid_cnx_lock
2          source = self.source
3          if self.cnx is None:
4              self.cnx = source.get_connection()
5          cnx = self.cnx
6 -        try:
7 -            cursor = cnx.cursor()
8 -            for sql in source.dbhelper.sqls_increment_numrange('entities_id_seq', count):
9 -                cursor.execute(sql)
10 -            eid = cursor.fetchone()[0]
11 -        except (source.OperationalError, source.InterfaceError):
12 -            # FIXME: better detection of deconnection pb
13 -            source.warning("trying to reconnect create eid connection")
14 -            self.cnx = None
15 -            return self._create_eid(count)
16 -        except source.DbapiError as exc:
17 -            # We get this one with pyodbc and SQL Server when connection was reset
18 -            if exc.args[0] == '08S01':
19 -                source.warning("trying to reconnect create eid connection")
20 -                self.cnx = None
21 -                return self._create_eid(count)
22 -            else:
23 -                raise
24 -        except Exception: # WTF?
25 -            cnx.rollback()
26 -            self.cnx = None
27 -            source.exception('create eid failed in an unforeseen way on SQL statement %s', sql)
28 -            raise
29 -        else:
30 -            cnx.commit()
31 -            return eid
32 +        cursor = cnx.cursor()
33 +        for sql in source.dbhelper.sqls_increment_numrange('entities_id_seq', count):
34 +            cursor.execute(sql)
35 +        eid = cursor.fetchone()[0]
36 +        cnx.commit()
37 +        return eid
38 
39 
40  class SQLITEEidGenerator(object):
41      __slots__ = ('source', 'lock')
42