Skip to content

fix: Add createBranch method implementation in StatsRecordingMetadataManager#27114

Merged
aditi-pandit merged 1 commit intoprestodb:masterfrom
agrawalreetika:build-fix
Feb 9, 2026
Merged

fix: Add createBranch method implementation in StatsRecordingMetadataManager#27114
aditi-pandit merged 1 commit intoprestodb:masterfrom
agrawalreetika:build-fix

Conversation

@agrawalreetika
Copy link
Copy Markdown
Member

@agrawalreetika agrawalreetika commented Feb 9, 2026

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

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.
  • If adding new dependencies, verified they have an OpenSSF Scorecard score of 5.0 or higher (or obtained explicit TSC approval for lower scores).

Summary by Sourcery

Bug Fixes:

  • Fix master build failure by providing a concrete createBranch implementation in StatsRecordingMetadataManager to match the metadata interface.

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== NO RELEASE NOTE ==

@agrawalreetika agrawalreetika requested a review from a team as a code owner February 9, 2026 14:00
@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Feb 9, 2026
@prestodb-ci prestodb-ci requested review from a team, Mariamalmesfer and auden-woolfson and removed request for a team February 9, 2026 14:00
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Feb 9, 2026

Reviewer's Guide

Implements 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 recording

sequenceDiagram
    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
Loading

Class diagram for StatsRecordingMetadataManager with new createBranch method

classDiagram
    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
Loading

File-Level Changes

Change Details Files
Implement createBranch in StatsRecordingMetadataManager with delegated call and stats recording.
  • Add createBranch override with full parameter list including branch options and retention settings
  • Delegate createBranch call to the underlying metadata manager (delegate) with all provided arguments
  • Measure execution time with System.nanoTime() and record it via stats after the call completes, even on exceptions
presto-main-base/src/main/java/com/facebook/presto/metadata/StatsRecordingMetadataManager.java

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@agrawalreetika agrawalreetika changed the title Add createBranch method implementation in StatsRecordingMetadataManager fix: Add createBranch method implementation in StatsRecordingMetadataManager Feb 9, 2026
@agrawalreetika agrawalreetika force-pushed the build-fix branch 2 times, most recently from 5621a23 to ffcbd0f Compare February 9, 2026 14:03
@aditi-pandit aditi-pandit merged commit 82c8390 into prestodb:master Feb 9, 2026
82 of 83 checks passed
@agrawalreetika agrawalreetika deleted the build-fix branch February 10, 2026 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

from:IBM PR from IBM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants