-
Notifications
You must be signed in to change notification settings - Fork 16.4k
[AIRFLOW-139] Let psycopg2 handle autocommit for PostgresHook #1821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I can't make anything regarding the cause of the error on Travis can someone help with that? |
|
+1 |
|
Can someone please advise on why the tests are failing? |
The server-side autocommit setting was removed here http://www.postgresql.org/docs/7.4/static/release-7-4.html Resolves: #690
|
Refer to the last lines of output before the table of coverage results. |
|
The fix for AIRFLOW-533 should have fixed the test case failure for this one, too. |
|
@danielzohar rebase and retry. I can then review for merge. |
Current coverage is 65.93% (diff: 100%)@@ master #1821 diff @@
==========================================
Files 129 129
Lines 9907 9957 +50
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 6545 6565 +20
- Misses 3362 3392 +30
Partials 0 0
|
|
@r39132 all done |
|
@r39132 just a reminder |
|
Thx :-) Looking now! |
|
@danielzohar Pls update the |
|
@danielzohar Any updates? |
|
@danielzohar if not further activity on this in the next few days, I will close for inactivity. |
|
@r39132 All done. Also got rid of a few unused imports along the way |
|
thx.. looking now. |
|
I'm seeing this in my example DAG. @mistercrunch @bolkedebruin @jlowin Any ideas on what the poison pill means and why I am seeing it? |
|
@danielzohar interesting.. tests are failing. I wonder if this is related to the poison pill messages I am seeing as well. Please fix. |
|
oh, silly me. That's the reason I created the PR in the first place! I set |
|
Green! |
|
Nice.. retesting locally! |
|
It looks like there is a side-effect of this change in that the |
|
@mistercrunch @bolkedebruin is this poison pill line innocuous? |
|
I don't like to poison pill thing. It means the state of the Taks has changed while it is at the executor. Will need to dive in to understand. |
|
@bolkedebruin Any further thoughts here? |
|
Worth stating that this is a very small change, a new test was added and the tests are green. |
|
Any thoughts on this? |
|
@danielzohar Sorry for taking so long. Can you provide operational details of this? I don't like what @r39132 is seeing and I don't have time to debug it myself. |
|
@danielzohar Ok I think this is ready for merging; The issue seen by @r39132 was unrelated and was fixed in @2016 |
The server-side autocommit setting was removed and reimplemented in client applications and languages. Server-side autocommit was causing too many problems with languages and applications that wanted to control their own autocommit behavior, so autocommit was removed from the server and added to individual client APIs as appropriate Closes apache#1821 from danielzohar/AIRFLOW- 139_vacuum_operator
|
If anybody (like me) still faced this issue: you need to add |



Dear Airflow Maintainers,
Please accept this PR that addresses the following issues:
https://issues.apache.org/jira/browse/AIRFLOW-139
Re-posting from the JIRA comment:
This indeed causes problems with (for example) Redshift.
I agree special cases should be discouraged though the current implementation definitely feels like a special case handling.
There was no issue attached to the original commit (28da05d) but I'm supposing it came due to https://www.postgresql.org/docs/7.4/static/release-7-4.html.
The documentation states:
"The server-side autocommit setting was removed and reimplemented in client applications and languages. Server-side autocommit was causing too many problems with languages and applications that wanted to control their own autocommit behavior, so autocommit was removed from the server and added to individual client APIs as appropriate."
As far as I can see, psycopg2 supports setting autocommit and I'd be very surprised if it didn't handle it well.
I tested it locally and I can confirm it works well with 9.5.4 with the following code:
In all honesty, I'm not sure what was the purpose of the original fix and I think those lines should be removed.
With regards to tests, I can't find where tests for hooks exist at the moment and what kind of things we might want to test. Also, are there any best practices on how we test against databases if at all? I think the added code should have had unit-tests, not really sure what we might want to test by removing the code, that
Postgres.Hook.autocommit = True?