8000 MasterSlaveConnection::ping() throws PDOException by sidz · Pull Request #3313 · doctrine/dbal · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

MasterSlaveConnection::ping() throws PDOException #3313

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

Closed
wants to merge 1 commit into from
Closed

MasterSlaveConnection::ping() throws PDOException #3313

wants to merge 1 commit into from

Conversation

sidz
Copy link
Contributor
@sidz sidz commented Oct 4, 2018
Q A
Type bug
BC Break yes
Fixed issues #3118 #2769

Summary

Fix existing issue with uncaught exception in the MasterSlaveConnection::query.
Also looks like ping method in the MasterSlaveConnection class will send pings to the slave connection:
https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php#L124-L133

I've marked it as BC Break as ping method will change it behavior in the MasterSlaveConnection and will ping master instead of slave

p.s. this PR covers 2 issues: #3118 and #2769

@@ -1673,7 +1674,7 @@ public function ping()
$this->query($this->getDatabasePlatform()->getDummySelectSQL());

return true;
} catch (DBALException $e) {
} catch (PDOException | DBALException $e) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When does a PDOException occur? I believe we upcast those, so this is fixing a symptom

Copy link
Contributor Author
@sidz sidz Oct 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we may stay with DBALException only for case when we will catch Throwable and convert them to the DBALException in the query methods.

https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Connection.php#L1011-L1015

*/
public function ping()
{
$this->connect('master');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems incorrect to me: it should simply ping whichever connection is already selected, as otherwise we may attempt to select the slave and then not get a valid response

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will revert

$statement = $this->_conn->query(...$args);
try {
$statement = $this->_conn->query(...$args);
} catch (Throwable $e) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above: we upcast these, so if we need to further wrap it there's something else going on

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sidz
Copy link
Contributor Author
sidz commented Oct 9, 2018

is the latest build random? oO

@morozov
Copy link
Member
morozov commented Oct 9, 2018

@sidz no, it just errored. I restarted the needed jobs.

@sidz
Copy link
Contributor Author
sidz commented Oct 9, 2018

@morozov doesn't help :(

@morozov
Copy link
Member
morozov commented Oct 9, 2018

@sidz should be related to https://www.traviscistatus.com/incidents/k35bqcmm5274.

@morozov
Copy link
Member
morozov commented Oct 12, 2018

@sidz please try rebasing on the latest master.

@sidz
Copy link
Contributor Author
sidz commented Oct 18, 2018

@morozov done

@morozov
Copy link
Member
morozov commented Oct 18, 2018

@sidz the Travis CI build is green but AppVeyor is all red. I've restarted it to see if it's something accidental.

@sidz
Copy link
Contributor Author
sidz commented Oct 29, 2018

@Ocramius ping for re-review

@morozov
Copy link
Member
morozov commented Jul 26, 2021

Irrelevant as of #4128.

@morozov morozov closed this Jul 26, 2021
@sidz sidz deleted the master-slave-connection-ping-does-not-work branch July 26, 2021 07:04
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0