-
Notifications
You must be signed in to change notification settings - Fork 296
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
Binary cache: async push_success #908
Merged
BillyONeal
merged 69 commits into
microsoft:main
from
autoantwort:feature/async-binary-cache-push-success
Feb 5, 2025
+692
−280
Merged
Changes from 68 commits
Commits
Show all changes
69 commits
Select commit
Hold shift + click to select a range
95f0438
Binary cache: async push_success
autoantwort 9d999d8
Merge branch 'main' into feature/async-binary-cache-push-success
autoantwort 163d9cd
Merge branch 'main' into feature/async-binary-cache-push-success
autoantwort 2a54205
Apply suggestions from code review
autoantwort 0912655
Adapt code review
autoantwort 5d7288c
Update src/vcpkg/binarycaching.cpp
autoantwort 10189ac
Adapt code review
autoantwort 2567607
Remove unnecessary actions_to_push_notifier.notify_all()
autoantwort ecdd000
Prevent deadlock and don't be on the crtl+c path
autoantwort 8e7ae61
Add and use BGMessageSink to print IBinaryProvider::push_success mess…
autoantwort 850d7c9
Restore old upload message
autoantwort 548be38
Don't join yourself
autoantwort 6dbbf06
Print messages about remaining packages to upload
autoantwort 74b86fd
Localization
autoantwort 5171d3e
Improve messages
autoantwort d69ed8f
No singleton and explicit calls to wait_for_async_complete()
autoantwort 2df42d5
Merge branch 'main' into feature/async-binary-cache-push-success
autoantwort 5f1786e
Merge branch 'main' into feature/async-binary-cache-push-success
autoantwort 93303c3
Merge branch 'main' into feature/async-binary-cache-push-success
autoantwort 8a26c8b
Merge branch 'main' into feature/async-binary-cache-push-success
autoantwort aa7e52f
Merge branch 'main' into feature/async-binary-cache-push-success
autoantwort d46a4d6
Apply code review
autoantwort 5e51718
Trigger Build
autoantwort a9ac558
No rename dance
autoantwort 4faf674
Print upload to provider only once and not once per provider
autoantwort b9be8c6
Fix tests
autoantwort 78ca081
Don't create unnecessary strings
autoantwort 579bfa9
Rename to m_published_lock
autoantwort 103968e
BinaryPackageInformation use Optional and make BinaryProviderPushRequ…
autoantwort dd32416
Merge branch 'main' into feature/async-binary-cache-push-success and …
autoantwort b666f94
Add missing files
autoantwort 15bb503
Add missing includes
autoantwort d995bfd
Make BianryCache a unique_ptr
autoantwort 24cd026
Reduce changes
autoantwort 92fc76b
Fix output
autoantwort 3527227
Fix bug
autoantwort 48305b3
Format
autoantwort 27fa076
Use lock_guard
autoantwort bcd459a
Revert "Use lock_guard"
autoantwort f958d36
Use enum
autoantwort 7a24007
BGMessageSink::print_published apply code review
autoantwort 50114f9
Merge branch 'main' into feature/async-binary-cache-push-success
autoantwort ca5f2b1
Merge branch 'main' into feature/async-binary-cache-push-success
autoantwort eccd9ee
Fix typo
autoantwort e7837e0
Fix typo in file name
autoantwort 969e7fc
Merge branch 'main' into feature/async-binary-cache-push-success
autoantwort 2d5586f
Merge branch 'main' into feature/async-binary-cache-push-success
autoantwort 809d0b6
Renamings
autoantwort 455e29b
format
autoantwort 03fdfea
Merge branch 'main' into feature/async-binary-cache-push-success
autoantwort f4bad8c
BinaryCache and std::unique_ptr
autoantwort 26bbbd5
Merge branch 'main' into feature/async-binary-cache-push-success
autoantwort 814e434
BinaryCache: save data in std::unique_ptr so that the object can be m…
autoantwort 290e586
fix
autoantwort 3cc3378
Merge branch 'main' into feature/async-binary-cache-push-success
autoantwort 978ceae
Merge branch 'main' into feature/async-binary-cache-push-success
autoantwort 47b56ce
Merge branch 'main' into feature/async-binary-cache-push-success
autoantwort 061e6e8
Merge branch 'main' into feature/async-binary-cache-push-success
autoantwort 050c51f
Merge remote-tracking branch 'origin/main' into feature/async-binary-…
BillyONeal 8182732
Merge remote-tracking branch 'origin/main' into feature/async-binary-…
BillyONeal 139c7da
Change find_last test to something that find (forward) won't pass.
BillyONeal 4f410f1
Collapse the background work queue system to handle completion of the…
BillyONeal 73b693a
Change BinaryCache and ZipTool's interface to avoid needing to copy o…
BillyONeal 54fe17f
Merge remote-tracking branch 'BillyONeal/contextize-ziptool' into fea…
BillyONeal 27780f9
Fixed upload status being printed to the terminal without synchroniza…
BillyONeal 8e15cf4
Use any_of, put a member FileSystem& back into BinaryCache, make sure…
BillyONeal 21de05a
* Combine submitted/completed counts into one atomic.
BillyONeal 8f372b2
Change submission count message slightly and avoid printing from BG t…
BillyONeal 8ecfdaa
Make the message count pettier.
BillyONeal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#pragma once | ||
|
||
#include <condition_variable> | ||
#include <mutex> | ||
#include <vector> | ||
|
||
template<class WorkItem> | ||
struct BackgroundWorkQueue | ||
{ | ||
template<class... Args> | ||
void push(Args&&... args) | ||
{ | ||
std::lock_guard<std::mutex> lock(m_mtx); | ||
m_tasks.emplace_back(std::forward<Args>(args)...); | ||
m_cv.notify_one(); | ||
} | ||
|
||
bool get_work(std::vector<WorkItem>& out) | ||
{ | ||
std::unique_lock<std::mutex> lock(m_mtx); | ||
for (;;) | ||
{ | ||
if (!m_tasks.empty()) | ||
{ | ||
out.clear(); | ||
swap(out, m_tasks); | ||
return true; | ||
} | ||
|
||
if (!m_running) | ||
{ | ||
return false; | ||
} | ||
|
||
m_cv.wait(lock); | ||
} | ||
} | ||
|
||
void stop() | ||
{ | ||
std::lock_guard<std::mutex> lock(m_mtx); | ||
m_running = false; | ||
m_cv.notify_all(); | ||
} | ||
|
||
private: | ||
std::mutex m_mtx; | ||
std::condition_variable m_cv; | ||
std::vector<WorkItem> m_tasks; | ||
bool m_running = true; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,5 @@ namespace vcpkg | |
|
||
struct FileSink; | ||
struct TeeSink; | ||
struct BGMessageSink; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -531,8 +531,6 @@ | |
"CommunityTriplets": "Community Triplets:", | ||
"CompilerPath": "Compiler found: {path}", | ||
"_CompilerPath.comment": "An example of {path} is /foo/bar.", | ||
"CompressFolderFailed": "Failed to compress folder \"{path}\":", | ||
"_CompressFolderFailed.comment": "An example of {path} is /foo/bar.", | ||
"ComputingInstallPlan": "Computing installation plan...", | ||
"ConfigurationErrorRegistriesWithoutBaseline": "The configuration defined in {path} is invalid.\n\nUsing registries requires that a baseline is set for the default registry or that the default registry is null.\n\nSee {url} for more details.", | ||
"_ConfigurationErrorRegistriesWithoutBaseline.comment": "An example of {path} is /foo/bar. An example of {url} is https://github.com/microsoft/vcpkg.", | ||
|
@@ -1458,8 +1456,10 @@ | |
"_SpecifyTargetArch.comment": "'vcpkg help triplet' is a command line that should not be localized An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", | ||
"StartCodeUnitInContinue": "found start code unit in continue position", | ||
"StoreOptionMissingSha": "--store option is invalid without a sha512", | ||
"StoredBinariesToDestinations": "Stored binaries in {count} destinations in {elapsed}.", | ||
"_StoredBinariesToDestinations.comment": "An example of {count} is 42. An example of {elapsed} is 3.532 min.", | ||
"SubmittingBinaryCacheBackground": "Starting submission of {spec} to {count} binary cache(s) in the background", | ||
"_SubmittingBinaryCacheBackground.comment": "An example of {spec} is zlib:x64-windows. An example of {count} is 42.", | ||
"SubmittingBinaryCacheComplete": "Completed submission of {spec} to {count} binary cache(s) in {elapsed}", | ||
"_SubmittingBinaryCacheComplete.comment": "An example of {spec} is zlib:x64-windows. An example of {count} is 42. An example of {elapsed} is 3.532 min.", | ||
"SuccessfulyExported": "Exported {package_name} to {path}", | ||
"_SuccessfulyExported.comment": "An example of {package_name} is zlib. An example of {path} is /foo/bar.", | ||
"SuggestGitPull": "The result may be outdated. Run `git pull` to get the latest results.", | ||
|
@@ -1599,7 +1599,7 @@ | |
"UpgradeInManifest": "Upgrade upgrades a classic mode installation and thus does not support manifest mode. Consider updating your dependencies by updating your baseline to a current value with vcpkg x-update-baseline and running vcpkg install.", | ||
"_UpgradeInManifest.comment": "'vcpkg x-update-baseline' and 'vcpkg install' are command lines and should not be localized.", | ||
"UpgradeRunWithNoDryRun": "If you are sure you want to rebuild the above packages, run this command with the --no-dry-run option.", | ||
"UploadingBinariesToVendor": "Uploading binaries for '{spec}' to '{vendor}' source \"{path}\".", | ||
"UploadingBinariesToVendor": "Uploading binaries for {spec} to {vendor} from {path}", | ||
"_UploadingBinariesToVendor.comment": "An example of {spec} is zlib:x64-windows. An example of {vendor} is Azure. An example of {path} is /foo/bar.", | ||
"UsageInstallInstructions": "you can install the usage file with the following CMake", | ||
"UsageTextHere": "the usage file is here", | ||
|
@@ -1721,6 +1721,8 @@ | |
"_VersionSpecMismatch.comment": "An example of {path} is /foo/bar. An example of {expected_version} is 1.3.8. An example of {actual_version} is 1.3.8.", | ||
"VersionVerifiedOK": "{version_spec} is correctly in the version database ({git_tree_sha})", | ||
"_VersionVerifiedOK.comment": "An example of {version_spec} is zlib:[email protected]. An example of {git_tree_sha} is 7cfad47ae9f68b183983090afd6337cd60fd4949.", | ||
"WaitUntilPackagesUploaded": "Waiting for {count} remaining binary cache submissions...", | ||
"_WaitUntilPackagesUploaded.comment": "An example of {count} is 42.", | ||
"WaitingForChildrenToExit": "Waiting for child processes to exit...", | ||
"WaitingToTakeFilesystemLock": "waiting to take filesystem lock on {path}...", | ||
"_WaitingToTakeFilesystemLock.comment": "An example of {path} is /foo/bar.", | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why does this depend on size_t?
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.
There are a lot of 64 bit machines without 32 bit atomics, and a lot of 32 bit machines without 64 bit atomics, and I wanted to choose something least likely to put us into lockful atomics world.