Skip to content

Fix cache overwrite during batch feature view apply#6211

Open
SARAMALI15792 wants to merge 2 commits intofeast-dev:masterfrom
SARAMALI15792:fix-cache-overwrite-in-feature-view-apply
Open

Fix cache overwrite during batch feature view apply#6211
SARAMALI15792 wants to merge 2 commits intofeast-dev:masterfrom
SARAMALI15792:fix-cache-overwrite-in-feature-view-apply

Conversation

@SARAMALI15792
Copy link
Copy Markdown

@SARAMALI15792 SARAMALI15792 commented Apr 1, 2026

Fixes the cache overwrite issue identified in #6210

Summary

This PR fixes a critical bug where _ensure_feature_view_name_is_unique was causing cache overwrites during batch feature view apply operations, resulting in loss of uncommitted in-memory changes.

Problem

The original fix in #6210 introduced a regression where calling _ensure_feature_view_name_is_unique with the default allow_cache=False parameter caused the getter methods to re-read from the registry store and overwrite self.cached_registry_proto, discarding any uncommitted changes.

This was triggered in feature_store.py:1199-1202 where apply_feature_view is called in a loop with commit=False after other uncommitted apply_project and apply_data_source calls:

for view in itertools.chain(views_to_update, odfvs_to_update, sfvs_to_update):
    self.registry.apply_feature_view(
        view, project=self.project, commit=False, no_promote=no_promote
    )

Each uniqueness check would overwrite the cache, losing:

  • Prior uncommitted projects and data sources (on first call)
  • Previously applied feature views (on subsequent calls)

Solution

Pass allow_cache=True to _ensure_feature_view_name_is_unique at line 758. This is safe because:

  1. _prepare_registry_for_changes already prepares the cache at line 755
  2. The cache contains all necessary data for uniqueness validation
  3. This preserves uncommitted in-memory state during batch operations

Changes

  • sdk/python/feast/infra/registry/registry.py:758: Add allow_cache=True parameter

Test Plan

Addresses the review feedback from #6210 (comment)


Open with Devin

CakeHub Developer added 2 commits April 1, 2026 14:00
The file-based registry was incorrectly checking for feature view name
conflicts across all projects in a shared registry, causing false positives
when different projects used the same feature view names.

This fix replaces the custom conflict checking logic with the base class
method _ensure_feature_view_name_is_unique, which properly scopes checks
by project. This aligns the file registry behavior with the SQL registry
implementation.

Changes:
- Use _ensure_feature_view_name_is_unique from BaseRegistry (same as SQL registry)
- Remove _check_conflicting_feature_view_names and _existing_feature_view_names_to_fvs methods
- Add regression test for cross-project feature view names

Fixes feast-dev#6209
Pass allow_cache=True to _ensure_feature_view_name_is_unique to prevent
cache overwrites when applying multiple feature views with commit=False.

The issue occurred because _ensure_feature_view_name_is_unique calls
getter methods with allow_cache=False by default, which triggers
_get_registry_proto to re-read from the store and overwrite
cached_registry_proto, discarding uncommitted in-memory changes.

This was triggered in feature_store.py where apply_feature_view is
called in a loop with commit=False after other uncommitted apply_project
and apply_data_source calls. Each uniqueness check would overwrite the
cache, losing prior uncommitted changes.

Since _prepare_registry_for_changes already prepares the cache at line
755, using allow_cache=True is safe and preserves uncommitted state
during batch operations.
@SARAMALI15792 SARAMALI15792 requested a review from a team as a code owner April 1, 2026 09:38
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 3 additional findings in Devin Review.

Open in Devin Review

Comment on lines +2197 to +2200
@pytest.mark.parametrize(
"test_registry",
all_fixtures,
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 New test missing @pytest.mark.integration marker, breaking test categorization

The new test_cross_project_feature_view_name_allowed test is missing the @pytest.mark.integration marker that every other parametrized test using all_fixtures in this file has (e.g., test_cross_type_feature_view_name_conflict at line 2081, test_cross_type_feature_view_odfv_conflict at line 2150, and all ~20 other tests). Without this marker, the test won't be selected when running integration tests via make test-python-integration (which filters by pytest.mark.integration), so the regression test for issue #6209 will never actually run in CI.

Suggested change
@pytest.mark.parametrize(
"test_registry",
all_fixtures,
)
@pytest.mark.integration
@pytest.mark.parametrize(
"test_registry",
all_fixtures,
)
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant