#15889 duckdb idmv#1
Merged
Merged
Conversation
added 17 commits
April 21, 2026 14:48
Refactored `EnableProfiling` in `DuckDBConnection` to simplify its interface by removing the `enabled` parameter. Added `DisableProfiling` and `ResetStatistics` methods for more granular control over profiling. Enhanced `ProfilingOptions` to support finer control over coverage and metrics. Updated `ConnectionStatistics` and `ProfilingInfo` to enable dynamic query execution tracing and improve thread safety. Modified `Program.cs` and `TpchBenchmarks.cs` to demonstrate the new profiling API. Added comprehensive unit tests in `ProfilingTests.cs` to validate profiling functionality, including edge cases and unsupported metrics. Improved exception handling and error messages for invalid profiling configurations.
Refactored profiling state management by introducing `IsProfilingEnabled` and `ProfilingOptions` at the `FileReference` level to ensure consistent profiling behavior across file-backed connections. Replaced `collectstats` with `isProfilingEnabled` for clarity and updated initialization logic to synchronize profiling state between connections. Improved profiling behavior for duplicated connections: - In-memory duplicates now maintain independent profiling statistics. - File-backed duplicates share profiling state and metrics. Refactored `LoadStatisticsProfile` for better error handling and simplified profiling configuration logic. Added unit tests to validate profiling behavior across various scenarios, ensuring correctness and reliability. Fixed a bug in `QueryProfiler` related to uninitialized dictionaries and removed redundant profiling code in duplicated connections.
This commit updates the DuckDBConnection class to include the `profilingOptions` parameter when initializing the `duplicatedConnection` object. This ensures that profiling options are properly passed and set during the duplication process.
Added new time-related utility methods in `TimerUtils.cs` for improved time tracking and conversions. Updated `PreparedStatement.cs` to ensure accurate query tracing by stopping the tracer after the last statement in a batch. Refactored `ConnectionStatistics.cs` to improve profiling summary calculations and reset logic. Simplified and cleaned up the sample program in `Program.cs` for better readability and functionality.
Refactored profiling infrastructure to use `ProfilingStatementSummary` for detailed statement-level metrics. Updated `MetricType.cs`, `ConnectionStatistics.cs`, `QueryProfiler.cs`, and `StatementProfiler.cs` to align with the new structure. Enhanced test coverage in `ProfilingTests.cs` to validate changes. Added SemVer-style prerelease and build metadata support in `irion-package.ps1`, including a new `Split-SemVersion` function and updated version bumping logic. Transitioned versioning to `1.5.2-alpha.1` in `irion.version`. Updated documentation in `README.md` to reflect versioning changes. General cleanup and alignment across the codebase to improve consistency and clarity.
added 3 commits
May 20, 2026 15:39
Refactored `TimerUtils` to use high-resolution timing with `Stopwatch.GetTimestamp()` and added `TimerToMilliseconds` for precise conversions. Simplified `CalculateTickCountElapsed` and removed redundant methods. Updated profiling configuration in `DuckDBConnection` to use `StringBuilder` for efficient query construction. Improved error handling and removed redundant checks. Replaced `Dictionary` with `ConcurrentDictionary` in `ConnectionStatistics` for thread safety. Added a fast path in `TryGetFor` to optimize lookups. Refactored `ProfilingInfo` and `StatementProfiler` to use raw metrics (`Dictionary<string, string>`) instead of `ProfilingInfoMetrics`. Updated related methods and properties for consistency. Changed `TimerUtils.Now()` usage to `DateTimeOffset` for better precision
Replaced legacy profiling and tracing classes with a unified `ExecutionProfiler` base class and `IExecutionProfiler` interface, simplifying the design and reducing redundancy. Removed `ExecutionStatistics`, `ExecutionTracer`, and related classes, consolidating their functionality. Updated `QueryProfiler` and `StatementProfiler` to inherit from `ExecutionProfiler`, streamlining their implementation. Removed `QueryProfilerTracer` and `StatementProfilerTracer`, with their responsibilities absorbed into the profilers. Refactored `PreparedStatement` to directly use the new profiling system, improving initialization, timer management, and error handling. Enhanced profiling metrics acquisition and eliminated async context-specific tracing. Improved code readability, maintainability, and performance by consolidating profiling functionality and reducing complexity. Adjusted namespaces to reflect the new structure.
Reorganized profiling-related classes into a new namespace `DuckDB.NET.Data.Profiling.Statistics.Summary` for better code structure. Enabled XML documentation file generation in `Bindings.csproj` and `Data.csproj` and suppressed warning 1591 for missing XML comments. Updated NuGet repository URL in `nuget.config` and bumped project version to `1.5.2.0-alpha.5`. No functional changes were made to profiling classes during the namespace move.
added 2 commits
May 22, 2026 16:24
Enhanced error handling in `DuckDBConnection`: - Retrieve detailed error messages and types on failure. - Throw `OperationCanceledException` for interrupt errors. - Include inner exceptions from `UdfExceptionStore` if available. - Ensure proper cleanup by closing `queryResult`. Added `EnableProfilingWithoutOptionsUsesDefaults` test: - Verifies default behavior when enabling profiling. - Ensures statistics collection and proper cleanup. Updated version to `1.5.2.0-alpha.6`.
added 3 commits
June 5, 2026 11:57
Replaced pointer-based query identifiers with thread-safe, integer-based IDs in `ConnectionStatistics`. Updated the `CreateQueryProfiler` method in both `PreparedStatement` and `ConnectionStatistics` to reflect this change. Introduced a new `nextQueryId` field with `Interlocked.Increment` to ensure thread-safe ID generation. Added the `GetNextQueryId` method, optimized with `[MethodImpl(MethodImplOptions.AggressiveInlining)]`. Updated `QueryProfiler` creation logic to use the new integer IDs and adjusted the `queryProfilers` dictionary accordingly. Simplified the `CreateQueryProfiler` method signature by removing the `queryIdentifier` parameter.
Changed the key type of the `queryProfilers` dictionary from `IntPtr` to `int` to simplify query profiler identification and improve consistency with other system components.
Refactored `PreparedStatement` to enhance error handling and ensure proper resource cleanup with a `try-finally` block. Updated `ConnectionStatistics` and `QueryProfiler` to improve timer management and profiling accuracy. Renamed `Infos` to `StatementSummaries` and `Metrics` for clarity and consistency. Enhanced `ProfilingTests` with new test cases for query and statement failure scenarios. Updated existing tests to validate the new profiling structure and ensure correctness of metrics, error states, and timing data. Improved profiling logic for accurate timing and error reporting at both query and statement levels. Cleaned up code, removed redundant comments, and ensured consistent naming conventions for better readability and maintainability.
Enhanced TimerUtils with sentinel handling for infinite durations and added a new `TimeSpanTicksToMilliseconds` method. Refactored ConnectionStatistics and ExecutionProfiler for accurate and consistent time conversions. Improved QueryProfiler and StatementProfiler with null safety and defensive checks. Expanded ProfilingTests with new test cases to validate time conversion consistency and profiling accuracy. Refactored existing tests for clarity and maintainability. Updated ProfilingTests namespaces and imports to align with project structure. Performed general code cleanup, improving readability and replacing redundant code with reusable methods.
- Move MetricsExtensions to DuckDBMetricsExtensions and update usages - Add ProfilingOptionsExtensions for SQL generation from options - Introduce DuckDBMetrics with static metric collections - Use IsProfilingEnabled and improve profiling state management - Refine profiling lifecycle and statistics reset/disposal - Enhance tests for profiling output path and JSON validation - General code cleanup and improved exception handling
- Disable profiling file output when OutputPath is empty - Add tests for clearing statistics, stopping file writes, and OutputPath removal - Ensure profiling configuration changes are reflected in output behavior and statistics
- Changed ProfilingSummary to allow nullable QuerySummaryList. - Updated NativeDebugResolver.Initialize to accept DLL path as parameter. - Enabled execution of multiple sample methods in Program.cs.
Added the Irion.DuckDB.NET.Benchmark project to DuckDB.NET.sln, including its project reference and build configuration mappings for Debug and Release modes.
… delays; update profiling summary to handle null QuerySummaryList.
… bumping logic in packaging script
Comment on lines
+318
to
+334
| $args = New-Object System.Collections.Generic.List[string] | ||
| foreach ($property in $MsBuildProperty) { | ||
| $trimmed = $property.Trim() | ||
| if ([string]::IsNullOrWhiteSpace($trimmed)) { | ||
| continue | ||
| } | ||
|
|
||
| if ($trimmed.StartsWith("/p:") -or $trimmed.StartsWith("-p:")) { | ||
| [void]$args.Add($trimmed) | ||
| } | ||
| else { | ||
| [void]$args.Add("/p:$trimmed") | ||
| } | ||
| } | ||
|
|
||
| return @($args) | ||
| } |
sashapodgoreanu
approved these changes
Jun 8, 2026
sashapodgoreanu
left a comment
Collaborator
There was a problem hiding this comment.
Per me tutto ok. mi aggiungo solo a commenti lasciati di copilot.
added 2 commits
June 8, 2026 14:39
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Added profiling functionality to DuckDBConnection based on CAPI ProfilingInfo.