<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/python-packages/psycopg2.git/tests/test_replication.py, branch issue-template</title>
<subtitle>github.com: psycopg/psycopg2.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/psycopg2.git/'/>
<entry>
<title>Smart replication feedback</title>
<updated>2019-05-06T08:27:44+00:00</updated>
<author>
<name>Alexander Kukushkin</name>
<email>alexander.kukushkin@zalando.de</email>
</author>
<published>2019-05-06T08:27:44+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/psycopg2.git/commit/?id=6cff5a3e089f155519765f9cdd49ef78b23ab740'/>
<id>6cff5a3e089f155519765f9cdd49ef78b23ab740</id>
<content type='text'>
This commit makes psycopg2 responsible for sending the status update
(feedback) messages to the server regardless of whether a synchronous or
asynchronous connection is used.

Feedback is sent every *status_update* (default value is 10) seconds,
which could be configured by passing a corresponding parameter to the
`start_replication()` or `start_replication_expert()` methods.
The actual feedback message is sent by the
`pq_read_replication_message()` when the *status_update* timeout is
reached.

The default behavior of the `send_feedback()` method is changed.
It doesn't send a feedback message on every call anymore but just
updates internal structures. There is still a way to *force* sending
a message if *force* or *reply* parameters are set.

The new approach has certain advantages:
1. The client can simply call the `send_feedback()` for every
   processed message and the library will take care of not overwhelming
   the server. Actually, in the synchronous mode it is even mandatory
   to confirm every processed message.
2. The library tracks internally the pointer of the last received
   message which is not keepalive. If the client confirmed the last
   message and after that server sends only keepalives with increasing
   *wal_end*, the library can safely move forward *flush* position to
   the *wal_end* and later automatically report it to the server.

Reporting of the *wal_end* received from keepalive messages is very
important. Not doing so casing:
1. Excessive disk usage, because the replication slot prevents from
   WAL being cleaned up.
2. The smart and fast shutdown of the server could last indefinitely
   because walsender waits until the client report *flush* position
   equal to the *wal_end*.

This implementation is only extending the existing API and therefore
should not break any of the existing code.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit makes psycopg2 responsible for sending the status update
(feedback) messages to the server regardless of whether a synchronous or
asynchronous connection is used.

Feedback is sent every *status_update* (default value is 10) seconds,
which could be configured by passing a corresponding parameter to the
`start_replication()` or `start_replication_expert()` methods.
The actual feedback message is sent by the
`pq_read_replication_message()` when the *status_update* timeout is
reached.

The default behavior of the `send_feedback()` method is changed.
It doesn't send a feedback message on every call anymore but just
updates internal structures. There is still a way to *force* sending
a message if *force* or *reply* parameters are set.

The new approach has certain advantages:
1. The client can simply call the `send_feedback()` for every
   processed message and the library will take care of not overwhelming
   the server. Actually, in the synchronous mode it is even mandatory
   to confirm every processed message.
2. The library tracks internally the pointer of the last received
   message which is not keepalive. If the client confirmed the last
   message and after that server sends only keepalives with increasing
   *wal_end*, the library can safely move forward *flush* position to
   the *wal_end* and later automatically report it to the server.

Reporting of the *wal_end* received from keepalive messages is very
important. Not doing so casing:
1. Excessive disk usage, because the replication slot prevents from
   WAL being cleaned up.
2. The smart and fast shutdown of the server could last indefinitely
   because walsender waits until the client report *flush* position
   equal to the *wal_end*.

This implementation is only extending the existing API and therefore
should not break any of the existing code.
</pre>
</div>
</content>
</entry>
<entry>
<title>Store WAL end pointer in the replication cursor</title>
<updated>2019-03-30T21:23:11+00:00</updated>
<author>
<name>Martins Grunskis</name>
<email>martins@grunskis.com</email>
</author>
<published>2018-10-29T08:50:31+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/psycopg2.git/commit/?id=f946042a79fc340d249589ff6acb8fdcb671e9f1'/>
<id>f946042a79fc340d249589ff6acb8fdcb671e9f1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Other import moved to top level in tests</title>
<updated>2019-03-16T19:13:58+00:00</updated>
<author>
<name>Daniele Varrazzo</name>
<email>daniele.varrazzo@gmail.com</email>
</author>
<published>2019-03-16T18:56:56+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/psycopg2.git/commit/?id=b0119fef816daf4f47191359dc3fa609f9783e2c'/>
<id>b0119fef816daf4f47191359dc3fa609f9783e2c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Move imports to the top of the module across tests</title>
<updated>2019-03-16T18:03:41+00:00</updated>
<author>
<name>Jon Dufresne</name>
<email>jon.dufresne@gmail.com</email>
</author>
<published>2019-03-16T15:30:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/psycopg2.git/commit/?id=d90ad8627d0a7244abeee7cd3a9418d529dc1428'/>
<id>d90ad8627d0a7244abeee7cd3a9418d529dc1428</id>
<content type='text'>
Allows removing many duplicate imports and better follows PEP8
guidelines:

https://www.python.org/dev/peps/pep-0008/#imports

&gt; Imports are always put at the top of the file, just after any module
&gt; comments and docstrings, and before module globals and constants.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Allows removing many duplicate imports and better follows PEP8
guidelines:

https://www.python.org/dev/peps/pep-0008/#imports

&gt; Imports are always put at the top of the file, just after any module
&gt; comments and docstrings, and before module globals and constants.
</pre>
</div>
</content>
</entry>
<entry>
<title>Copyright year updated</title>
<updated>2019-02-17T01:36:36+00:00</updated>
<author>
<name>Daniele Varrazzo</name>
<email>daniele.varrazzo@gmail.com</email>
</author>
<published>2019-02-17T01:34:52+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/psycopg2.git/commit/?id=599432552aae4941c2b282e9251330f1357b2a45'/>
<id>599432552aae4941c2b282e9251330f1357b2a45</id>
<content type='text'>
    ag -l Copyright | xargs sed -i \
        "s/\(.*copyright (C) [0-9]\+\)\(-[0-9]\+\)\?\(.*\)/\1-$(date +%Y)\3/I"
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
    ag -l Copyright | xargs sed -i \
        "s/\(.*copyright (C) [0-9]\+\)\(-[0-9]\+\)\?\(.*\)/\1-$(date +%Y)\3/I"
</pre>
</div>
</content>
</entry>
<entry>
<title>Use relative imports throughout tests</title>
<updated>2017-12-10T18:51:07+00:00</updated>
<author>
<name>Jon Dufresne</name>
<email>jon.dufresne@gmail.com</email>
</author>
<published>2017-12-04T02:47:19+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/psycopg2.git/commit/?id=1a8e992fcc87b2d15911b60cc9220ec50a70a4ff'/>
<id>1a8e992fcc87b2d15911b60cc9220ec50a70a4ff</id>
<content type='text'>
The tests relied on Python2 relative import semantics. Python3 changed
import semantics to always search sys.path by default. To import using a
relative path it must have a leading dot.

Forward compatible with newer Pythons.

Works towards the goal of moving tests outside of the installed package.

For more information, see PEP-328:

https://www.python.org/dev/peps/pep-0328/
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The tests relied on Python2 relative import semantics. Python3 changed
import semantics to always search sys.path by default. To import using a
relative path it must have a leading dot.

Forward compatible with newer Pythons.

Works towards the goal of moving tests outside of the installed package.

For more information, see PEP-328:

https://www.python.org/dev/peps/pep-0328/
</pre>
</div>
</content>
</entry>
<entry>
<title>Always import the system unittest</title>
<updated>2017-12-02T02:35:30+00:00</updated>
<author>
<name>Jon Dufresne</name>
<email>jon.dufresne@gmail.com</email>
</author>
<published>2017-12-02T01:59:53+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/psycopg2.git/commit/?id=fcc083dc123946039fdfc88c55bbd4902dadd52a'/>
<id>fcc083dc123946039fdfc88c55bbd4902dadd52a</id>
<content type='text'>
There is no need to import testutils.unittest instead of simply
unittest. They are simple aliases. Use system unittest to be more
regular, consistent as well as idiomatic with the wider Python
community.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There is no need to import testutils.unittest instead of simply
unittest. They are simple aliases. Use system unittest to be more
regular, consistent as well as idiomatic with the wider Python
community.
</pre>
</div>
</content>
</entry>
<entry>
<title>Accept Composable in start_replication_expert()</title>
<updated>2017-06-17T02:30:44+00:00</updated>
<author>
<name>Daniele Varrazzo</name>
<email>daniele.varrazzo@gmail.com</email>
</author>
<published>2017-06-17T02:16:41+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/psycopg2.git/commit/?id=1a97445471492a62e89d8e26cffdb3b640132174'/>
<id>1a97445471492a62e89d8e26cffdb3b640132174</id>
<content type='text'>
Close #554
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Close #554
</pre>
</div>
</content>
</entry>
<entry>
<title>Fixed args parsing in ReplicationCursor.consume_stream()</title>
<updated>2017-04-19T00:01:59+00:00</updated>
<author>
<name>Daniele Varrazzo</name>
<email>daniele.varrazzo@gmail.com</email>
</author>
<published>2017-04-19T00:01:59+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/psycopg2.git/commit/?id=248e653c9e2ec2dfc0b1eac9561981b34a637f9d'/>
<id>248e653c9e2ec2dfc0b1eac9561981b34a637f9d</id>
<content type='text'>
Close #547.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Close #547.
</pre>
</div>
</content>
</entry>
<entry>
<title>Added async_ as an alias for async</title>
<updated>2017-02-03T04:43:49+00:00</updated>
<author>
<name>Daniele Varrazzo</name>
<email>daniele.varrazzo@gmail.com</email>
</author>
<published>2017-02-03T04:28:27+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/psycopg2.git/commit/?id=ce9be69615c700a0472098c5db171d33091c0b5a'/>
<id>ce9be69615c700a0472098c5db171d33091c0b5a</id>
<content type='text'>
Added in argument for psycopg2.connect() and connection.__init__, and
for the connection.async attribute.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Added in argument for psycopg2.connect() and connection.__init__, and
for the connection.async attribute.
</pre>
</div>
</content>
</entry>
</feed>
