-
Notifications
You must be signed in to change notification settings - Fork 736
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
Re-work connections and connection pool in favor of Node Pool #2188
Changes from 3 commits
00b376d
fabcbd1
ff9abe7
cdcf049
41f79c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,12 +17,9 @@ | |
"require": { | ||
"php": "~8.0.0 || ~8.1.0 || ~8.2.0", | ||
"ext-json": "*", | ||
"elastic/transport": "^8.4", | ||
"elastic/transport": "^8.8", | ||
"elasticsearch/elasticsearch": "^8.4.1", | ||
"guzzlehttp/psr7": "^2.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no longer used directly |
||
"nyholm/dsn": "^2.0.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No longer needed as we rely on |
||
"psr/log": "^1.0 || ^2.0 || ^3.0", | ||
"symfony/deprecation-contracts": "^3.0" | ||
"psr/log": "^1.0 || ^2.0 || ^3.0" | ||
}, | ||
"require-dev": { | ||
"guzzlehttp/guzzle": "^7.2", | ||
|
@@ -31,9 +28,11 @@ | |
"phpunit/phpunit": "^9.5", | ||
"symfony/phpunit-bridge": "^6.0" | ||
}, | ||
"conflict": { | ||
"guzzlehttp/psr7": "<2.0.0" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't have direct dependency to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if there is a way we could add a note around this to the code somewhere. I'm worried someone comes along eventually and removes it and we don't see the side effects immediately. The good news is, that now if someone goes back to where it was introduced, they see these comments. |
||
}, | ||
"suggest": { | ||
"aws/aws-sdk-php": "Allow using IAM authentication with Amazon ElasticSearch Service", | ||
"guzzlehttp/guzzle": "Allow using guzzle as transport", | ||
"monolog/monolog": "Logging request" | ||
}, | ||
"autoload": { | ||
|
@@ -49,11 +48,12 @@ | |
"config": { | ||
"allow-plugins": { | ||
"php-http/discovery": true | ||
} | ||
}, | ||
"sort-packages": true | ||
}, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "7.0.x-dev" | ||
"dev-master": "8.0.x-dev" | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,8 +133,12 @@ public function getActions(): array | |
*/ | ||
public function addDocument(Document $document, ?string $opType = null): self | ||
{ | ||
if (!$document->hasRetryOnConflict() && $this->_client->hasConnection() && $this->_client->getConnection()->hasParam('retryOnConflict') && ($retry = $this->_client->getConnection()->getParam('retryOnConflict')) > 0) { | ||
$document->setRetryOnConflict($retry); | ||
if (!$document->hasRetryOnConflict()) { | ||
$retry = $this->_client->getConfigValue('retryOnConflict', 0); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this directly related to the change? Maybe make it a quick second PR if not? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. because Client class doesn't have getConnection method so I had to find another way to get configuration value |
||
|
||
if ($retry > 0) { | ||
$document->setRetryOnConflict($retry); | ||
} | ||
} | ||
|
||
$action = AbstractDocumentAction::create($document, $opType); | ||
|
@@ -161,8 +165,12 @@ public function addDocuments(array $documents, ?string $opType = null): self | |
*/ | ||
public function addScript(AbstractScript $script, ?string $opType = null): self | ||
{ | ||
if (!$script->hasRetryOnConflict() && $this->_client->hasConnection() && $this->_client->getConnection()->hasParam('retryOnConflict') && ($retry = $this->_client->getConnection()->getParam('retryOnConflict')) > 0) { | ||
$script->setRetryOnConflict($retry); | ||
if (!$script->hasRetryOnConflict()) { | ||
$retry = $this->_client->getConfigValue('retryOnConflict', 0); | ||
|
||
if ($retry > 0) { | ||
$script->setRetryOnConflict($retry); | ||
} | ||
} | ||
|
||
$action = AbstractDocumentAction::create($script, $opType); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since 8.8 elastic/transport supports basic authentication per node. see elastic/elastic-transport-php#22
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume even if we use 8.8, Elastica will still be compatible with older versions of Elasticsearch 8.x
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes