[Ingest Manager] Agent fix snapshot download for upgrade#22175
[Ingest Manager] Agent fix snapshot download for upgrade#22175michalpristas merged 3 commits intoelastic:masterfrom
Conversation
|
Pinging @elastic/ingest-management (Team:Ingest Management) |
a26d157 to
6a5a2b5
Compare
|
Is there an easy way to test this change? |
| return "", errors.New(err, "fetching package failed", errors.TypeNetwork, errors.M(errors.MetaKeyURI, sourceURI)) | ||
| } | ||
|
|
||
| destinationFile, err := os.OpenFile(fullPath, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, packagePermissions) |
There was a problem hiding this comment.
This was moved to take the local file into account first? Not sure I fully follow this part here.
There was a problem hiding this comment.
I think it was to ensure that the file path to write to can be opened before even starting the HTTP connection.
There was a problem hiding this comment.
yes exactly, just a micro optimization
blakerouse
left a comment
There was a problem hiding this comment.
Overall looks good, just a few questions. No blockers.
| settings := *u.settings | ||
|
|
||
| // agent binaries are a bit larger and do not fit into normal timeout on slower connections | ||
| settings.Timeout = 120 * time.Second |
There was a problem hiding this comment.
Is this still enough time? How are you deciding this number?
There was a problem hiding this comment.
i was also thining about N x standard timeout from config which seems more ok
| SourceURI: "https://artifacts.elastic.co/downloads/", | ||
| TargetDirectory: filepath.Join(homePath, "downloads"), | ||
| Timeout: 30 * time.Second, | ||
| Timeout: 60 * time.Second, // binaries are a bit larger it might take >30s to download them |
There was a problem hiding this comment.
You used 120 above and 60 here, why the difference?
There was a problem hiding this comment.
this one is used for beats and endpoint, these binaries a smaller so it enables us to fail faster in case somethigns wrong.
i'm considering 2 approaches: have agent timeout *2 of what this regular is set to
or set this to higher number but slow down processing loop in case server responds very slowly
There was a problem hiding this comment.
Will it really be slower? A TCP reset will not rely on timeout, it's only in the case the server stops pushing data in the HTTP response. I see that as a very rare-case.
There was a problem hiding this comment.
not really slower, but it takes more time to download 100megs than 40, we use this as a timecap for execution of the whole request. not only getting a response
| return "", errors.New(err, "fetching package failed", errors.TypeNetwork, errors.M(errors.MetaKeyURI, sourceURI)) | ||
| } | ||
|
|
||
| destinationFile, err := os.OpenFile(fullPath, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, packagePermissions) |
There was a problem hiding this comment.
I think it was to ensure that the file path to write to can be opened before even starting the HTTP connection.
[Ingest Manager] Agent fix snapshot download for upgrade (elastic#22175)
[Ingest Manager] Agent fix snapshot download for upgrade (elastic#22175)
* upstream/master: (93 commits) Update commands used in the quick start (elastic#22248) Add interval documentation to `monitor` metricset (elastic#22152) [CI] enable x-pack/packetbeat in the CI (elastic#22252) Fix awscloudwatch input documentation (elastic#22247) Add support for different Azure Cloud environments in the metricbeat azure module (elastic#21044) [CI] support windows-2008-r2 (elastic#19791) protect against accessing undefined variables in sysmon module (elastic#22236) [CI] archive only if failed steps (elastic#22220) Add pe fields to Sysmon module (elastic#22217) [CI][flaky] Support 7.x branches and PRs (elastic#22197) Perfmon - Fix regular expressions to comply to multiple parentheses in instance name and object (elastic#22146) ci: improve linting speed (elastic#22103) Move cloudfoundry tags with metadata to common metadata fields (elastic#22150) [Docs] Update custom beat docs (elastic#22194) [Ingest Manager] Agent fix snapshot download for upgrade (elastic#22175) Update shared-autodiscover.asciidoc (elastic#21827) [DOCS] Warn about compression and Azure Event Hub for Kafka (elastic#21578) [CI][flaky] reporting for PRs in GitHub (elastic#21853) [Packetbeat] Create x-pack magefile (elastic#21979) [Elastic Agent] Fix deb/rpm installation (elastic#22153) ...
* upstream/master: (93 commits) Update commands used in the quick start (elastic#22248) Add interval documentation to `monitor` metricset (elastic#22152) [CI] enable x-pack/packetbeat in the CI (elastic#22252) Fix awscloudwatch input documentation (elastic#22247) Add support for different Azure Cloud environments in the metricbeat azure module (elastic#21044) [CI] support windows-2008-r2 (elastic#19791) protect against accessing undefined variables in sysmon module (elastic#22236) [CI] archive only if failed steps (elastic#22220) Add pe fields to Sysmon module (elastic#22217) [CI][flaky] Support 7.x branches and PRs (elastic#22197) Perfmon - Fix regular expressions to comply to multiple parentheses in instance name and object (elastic#22146) ci: improve linting speed (elastic#22103) Move cloudfoundry tags with metadata to common metadata fields (elastic#22150) [Docs] Update custom beat docs (elastic#22194) [Ingest Manager] Agent fix snapshot download for upgrade (elastic#22175) Update shared-autodiscover.asciidoc (elastic#21827) [DOCS] Warn about compression and Azure Event Hub for Kafka (elastic#21578) [CI][flaky] reporting for PRs in GitHub (elastic#21853) [Packetbeat] Create x-pack magefile (elastic#21979) [Elastic Agent] Fix deb/rpm installation (elastic#22153) ...
What does this PR do?
There was a version mismatch for snapshot downloads. WHen upgrading it tried to download current version snapshot instead of desired one.
Also as my connection is acting funny today and is not the fastest i run into issue when timeout occurred frequently when downloading elastic-agent snapshot so i increased timeout for this scenario.
Why is it important?
Snapshot upgrades
Checklist
CHANGELOG.next.asciidocorCHANGELOG-developer.next.asciidoc.