-
Notifications
You must be signed in to change notification settings - Fork 294
[Model Monitoring] Fix TSDB table creation when same credentials are set (ML-11807) #9118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…set (ML-11807) When set_credentials() is called with the same credentials that are already configured, the code returned early without calling _create_tsdb_tables(). This caused "UndefinedTable" errors if the TSDB tables were deleted or didn't exist yet. The fix ensures _create_tsdb_tables() is always called, even on the early return path. This is safe because all TSDB connector implementations use idempotent table creation: - V3IO: if_exists=v3io_frames.IGNORE - TDEngine: CREATE STABLE IF NOT EXISTS - TimescaleDB: CREATE TABLE IF NOT EXISTS
| ) | ||
| # Even if credentials match, ensure TSDB tables exist (ML-11807). | ||
| # This handles cases where tables were deleted or don't exist yet. | ||
| # The create_tables() call is idempotent (uses CREATE TABLE IF NOT EXISTS). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This depends on the connector though. Are they all idempotent? They don't all use CREATE TABLE IF NOT EXISTS, that's certain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like the answer is that they are idempotent, so just need to clear up the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
| tsdb_profile = self._validate_and_get_tsdb_profile( | ||
| tsdb_profile_name | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we also need to
secrets_dict[
mlrun.common.schemas.model_monitoring.ProjectSecretKeys.TSDB_PROFILE_NAME
] = tsdb_profile_name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we don't need to set secrets_dict here.
This is the early return path where credentials are already stored in project secrets:
check_if_credentials_are_set()(line 1824) confirmed credentials exist_is_the_same_cred()(line 1825) confirmed they match the provided values- We return at line 1838, never reaching
store_project_secrets()(line 1880)
The secrets_dict variable is only used later to store secrets, but since the credentials are already stored correctly, we just need to ensure the TSDB tables exist.
Summary
set_credentials()returns early without creating TSDB tables when the same credentials are already setUndefinedTableerrors if tables were deleted or didn't exist yet_create_tsdb_tables()before the early return, which is safe because all TSDB connectors use idempotent table creation