Skip to content

Conversation

Weves
Copy link
Contributor

@Weves Weves commented May 2, 2025

Description

Previously, if you set the POSTGRES_DEFAULT_SCHEMA env variable, it wouldn't be respected in PgRedisKVStore, which causes issues.

Fixes https://linear.app/danswer/issue/DAN-1938/use-correct-schema-in-kv-store

How Has This Been Tested?

Tested different schema locally.

Backporting (check the box to trigger backport action)

Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.

  • This PR should be backported (make sure to check that the backport attempt succeeds)
  • [Optional] Override Linear Check

@Weves Weves requested a review from a team as a code owner May 2, 2025 17:22
Copy link

vercel bot commented May 2, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
internal-search ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 4, 2025 9:11pm

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR simplifies the key-value store implementation by removing custom session management and tenant-specific logic, while ensuring proper schema handling through the standard session context manager.

  • Removes unnecessary tenant_id tracking and custom _get_session() context manager in /backend/onyx/key_value_store/store.py
  • Simplifies Redis client initialization by using get_redis_client() directly instead of custom tenant-specific logic
  • Ensures proper schema handling by using standard get_session_context_manager() instead of explicit schema setting
  • Maintains backward compatibility with existing KV store functionality while reducing code complexity

1 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

_lock: threading.Lock = threading.Lock()
_app_name: str = POSTGRES_UNKNOWN_APP_NAME

# NOTE(rkuo) - this appears to be unused, clean it up?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not used, was moved into the init_engine function



@asynccontextmanager
async def get_async_session_with_tenant(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

replaced with get_async_session_context_manager

@Weves Weves force-pushed the chris/dan-1938 branch from cc21604 to cf62c45 Compare May 4, 2025 21:05
@Weves Weves enabled auto-merge May 4, 2025 21:05
@Weves Weves added this pull request to the merge queue May 4, 2025
Merged via the queue into main with commit 7763e2f May 4, 2025
11 checks passed
@Weves Weves deleted the chris/dan-1938 branch May 4, 2025 23:35
Weves added a commit that referenced this pull request May 6, 2025
* Fix non-default schema in KV store

* Fix custom schema
AnkitTukatek pushed a commit to TukaTek/onyx that referenced this pull request Sep 23, 2025
* Fix non-default schema in KV store

* Fix custom schema
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.

2 participants