-
-
Notifications
You must be signed in to change notification settings - Fork 198
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
Add support for forward compatible binlog format #732
Add support for forward compatible binlog format #732
Conversation
356cacb
to
b1fa69a
Compare
My initial gut reaction is that forward compat should be the default for all readers, and if there are compat issues we can emit a synthetic So I'd remove things like ForwardCompatibilityExplicitlyConfigured, -fwd, and related things and keep it as simple as possible. Since the current behavior is we throw an exception, literally anything else is an improvement. I'd like users to update to this version of the NuGet and not have to change anything and be automatically opted in. The new GUI seems nice, but I'd think it's an overkill (just display a synthetic Error or Warning like I suggest above at the very top of the tree). But since you've already built it, might as well leave it I guess. I think users won't see this often anyway, since the viewer updates when it starts. |
src/StructuredLogger/BinaryLogger/Postprocessing/ReaderErrorType.cs
Outdated
Show resolved
Hide resolved
src/StructuredLogger/BinaryLogger/ForwardCompatibilityReadSettings.cs
Outdated
Show resolved
Hide resolved
Overall everything looks good. After all the changes on the MSBuild side are finalized, do the same changes here and then we can merge this one first. Then I'll publish the viewer and the NuGet and the CLI tools, and then we can merge the MSBuild side. One concern is that we should ensure the Avalonia version still works. I don't think it needs the GUI or the stats, but at least opening binlogs from the future should work fine. Ideally if you switch to emitting synthetic errors/warnings instead of custom data on the build or via events, both WPF and Avalonia will get it for free. Just remember to maybe only emit a single error per record type (otherwise we risk reporting thousands of identical errors). My preferred experience for the consumers of the MSBuild.StructuredLogger NuGet package is that they'll update to the new version and they don't have to change anything else or consume any other API. If they read a binlog from the future with unknown records, emit BuildErrorEventArgs and let them handle it they way they want. If they display the errors someplace, they will see the errors and know to update the NuGet to latest. If they don't see the errors, they probably don't care either, in this way we can just be silent. They could opt in into throwing when the file format is from the future if they want to be notified. This was a gargantuan amount of work, thanks a ton for driving this! Don't worry about the CLI, this stuff is still all experimental. Anything is fine. |
I just wanted to flash something e-2-e to have easier discussion over it. No feelings attached to any of it - any of the code can go :-) Btw. I marked MSBuild changes as not mergable - until new viewer and binlogtools are published. Otherwise it's ready to go - but if you'd have any suggestions or concerns there, definitely still easy to make changes. |
I left some comments on the MSBuild change - did you see? Nothing critical but some might be beneficial. |
@KirillOsenkov - btw. I noticed that replaying binlog in the 'raw' mode is slower and leads to bigger resulting file than with structured replay. |
tl;dr;: Fixed 🎉 (after long long long evening :-)) 1.0.9 (previous released) mean redact time for OrchardCore binlog: 00:00:22.1181747 1.0.9 (previous released) mean log replay time of raw events for OrchardCore binlog: 00:00:22.4146649 The issue was hidden in the superfluous flushing of the |
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.
Thank you so much!
I published https://www.nuget.org/packages/binlogtool/1.0.10 with the latest main branch that includes this PR |
Published https://www.nuget.org/packages/MSBuild.StructuredLogger/2.2.155 as well, @jaredpar if you're feeling adventurous maybe update the package to 2.2.155 and then when MSBuild increments the file format version to 18 hopefully it'll just work and you won't have a build break. |
Published viewer update https://github.com/KirillOsenkov/MSBuildStructuredLog/releases/tag/v2.2.155 |
Context
Complement to MSBuild PR dotnet/msbuild#9307
This introduces capability to understand the new log format that contains event offsets - with those, reader can detect issues with individual events and choose how to handle those (recover/skip/fail). Logs now as well contain the minimum needed version of reader - to capture situations where new log format changes beyond comprehension ability of particular reader version.
User is still given the ability to decide the level of compatibility and see the resulting stats of compatability issues.
Further info
Some perf stats: JanKrivanek/msbuild#1
MSBuild parent bug: dotnet/msbuild#9261
UX v2
GUI
CLI
Unchanged
API
The
Serialization.Read
method will accept optionalReaderSettings
withUnknownDataBehavior
parameter (of an enum type with the same name). If not specified, the compatibility issues are summarized in a single synthetized Error node on the Build.stop reading from here below - captures historic evolution of the PR that is not part of the final version
UX (reverted)
GUI
Cancel
:OK
:File
->Stats
(upon expanding all collapsed nodes):CLI
API
The
Serialization.Read
method will accept optionalIForwardCompatibilityReadSettings
- if not specified, the legacy behavior (exception on newer format) is preserved:To leverage the new behavior - one need to specify the forward compatibility handler - e.g.:
The handler allows granular control of opt-ing into the forward compatibility behavior (in case incompatibility is encountered) and handling the individual reading errors. For summary the reading errors are stored in
Build.RecoverableReadingErrors
property.Alternatively a
ForwardCompatibilityReadingHandler
from binlogtool can be used: