fix: Add createBranch method implementation in StatsRecordingMetadataManager#27114
Merged
aditi-pandit merged 1 commit intoprestodb:masterfrom Feb 9, 2026
Merged
fix: Add createBranch method implementation in StatsRecordingMetadataManager#27114aditi-pandit merged 1 commit intoprestodb:masterfrom
aditi-pandit merged 1 commit intoprestodb:masterfrom
Conversation
Contributor
Reviewer's GuideImplements the newly required createBranch method in StatsRecordingMetadataManager by delegating to the underlying Metadata implementation while wrapping the call with timing-based statistics recording, mirroring the existing pattern used for other metadata operations. Sequence diagram for createBranch call with stats recordingsequenceDiagram
participant Client
participant StatsRecordingMetadataManager
participant Metadata as DelegateMetadata
participant MetadataStats
Client->>StatsRecordingMetadataManager: createBranch(session, tableHandle, branchName, replace, ifNotExists, tableVersion, retainDays, minSnapshotsToKeep, maxSnapshotAgeDays)
activate StatsRecordingMetadataManager
StatsRecordingMetadataManager->>StatsRecordingMetadataManager: startTime = System.nanoTime()
StatsRecordingMetadataManager->>DelegateMetadata: createBranch(session, tableHandle, branchName, replace, ifNotExists, tableVersion, retainDays, minSnapshotsToKeep, maxSnapshotAgeDays)
activate DelegateMetadata
DelegateMetadata-->>StatsRecordingMetadataManager: return
deactivate DelegateMetadata
StatsRecordingMetadataManager->>StatsRecordingMetadataManager: duration = System.nanoTime() - startTime
StatsRecordingMetadataManager->>MetadataStats: recordDropBranchCall(duration)
deactivate StatsRecordingMetadataManager
MetadataStats-->>StatsRecordingMetadataManager: return
StatsRecordingMetadataManager-->>Client: return
Class diagram for StatsRecordingMetadataManager with new createBranch methodclassDiagram
class StatsRecordingMetadataManager {
Metadata delegate
MetadataStats stats
+dropBranch(session, tableHandle, branchName)
+createBranch(session, tableHandle, branchName, replace, ifNotExists, tableVersion, retainDays, minSnapshotsToKeep, maxSnapshotAgeDays)
+dropTag(session, tableHandle, tagName, tagExists)
}
class Metadata {
+createBranch(session, tableHandle, branchName, replace, ifNotExists, tableVersion, retainDays, minSnapshotsToKeep, maxSnapshotAgeDays)
}
class MetadataStats {
+recordDropBranchCall(durationNanos)
}
StatsRecordingMetadataManager --> Metadata : delegatesTo
StatsRecordingMetadataManager --> MetadataStats : recordsStatsWith
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- In the new createBranch implementation you are recording stats via recordDropBranchCall, which looks like a copy-paste error and should likely use a create-branch-specific stats method (or a more generic one) for accurate metrics.
- The parameter indentation in the createBranch method signature does not match the surrounding code style; consider aligning the wrapped parameters to be consistent with other multi-line method definitions in this class.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In the new createBranch implementation you are recording stats via recordDropBranchCall, which looks like a copy-paste error and should likely use a create-branch-specific stats method (or a more generic one) for accurate metrics.
- The parameter indentation in the createBranch method signature does not match the surrounding code style; consider aligning the wrapped parameters to be consistent with other multi-line method definitions in this class.
## Individual Comments
### Comment 1
<location> `presto-main-base/src/main/java/com/facebook/presto/metadata/StatsRecordingMetadataManager.java:1014-1018` </location>
<code_context>
+ Optional<Long> maxSnapshotAgeDays)
+ {
+ long startTime = System.nanoTime();
+ try {
+ delegate.createBranch(session, tableHandle, branchName, replace, ifNotExists, tableVersion, retainDays, minSnapshotsToKeep, maxSnapshotAgeDays);
+ }
+ finally {
+ stats.recordDropBranchCall(System.nanoTime() - startTime);
+ }
+ }
</code_context>
<issue_to_address>
**issue:** Using `recordDropBranchCall` in `createBranch` looks like a copy-paste error
This wrapper calls `createBranch`, but the timing metric is `recordDropBranchCall(...)`, unlike the rest of the class where each operation has its own metric. If there is a `recordCreateBranchCall` (or similar), it should be used here; otherwise, add a dedicated create-branch metric rather than reusing the drop-branch one.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
presto-main-base/src/main/java/com/facebook/presto/metadata/StatsRecordingMetadataManager.java
Outdated
Show resolved
Hide resolved
5621a23 to
ffcbd0f
Compare
tdcmeehan
approved these changes
Feb 9, 2026
ffcbd0f to
8af2b92
Compare
This was referenced Mar 31, 2026
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.
Description
Add createBranch method implementation in StatsRecordingMetadataManager
This started failing master build after merging - #26875 (Since branch support was merged earlier #26898)
Motivation and Context
Build fix
Impact
Add createBranch method implementation in StatsRecordingMetadataManager
This started failing master build after merging - #26875 (Since branch support was merged earlier #26898)
Test Plan
NA
Contributor checklist
Summary by Sourcery
Bug Fixes:
Release Notes
Please follow release notes guidelines and fill in the release notes below.