Skip to content
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

SNOW-1720835 param protect thread-safe client side changes #2401

Merged
merged 48 commits into from
Oct 17, 2024

Conversation

sfc-gh-aalam
Copy link
Contributor

@sfc-gh-aalam sfc-gh-aalam commented Oct 4, 2024

  1. Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR.

    Fixes SNOW-1720835

  2. Fill out the following pre-review checklist:

    • I am adding a new automated test(s) to verify correctness of my new code
      • If this test skips Local Testing mode, I'm requesting review from @snowflakedb/local-testing
    • I am adding new logging messages
    • I am adding a new telemetry message
    • I am adding new credentials
    • I am adding a new dependency
    • If this is a new feature/behavior, I'm adding the Local Testing parity changes.
    • I acknowledge that I have ensured my changes to be thread-safe.
  3. Please describe how your code solves the related issue.

    This PR adds param protection and uses DummyLock and DummyThreadLocal objects when thread-safe session is not enabled for session. This will be removed once thread-safe session is fully rolled out.

Copy link

github-actions bot commented Oct 4, 2024

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

@github-actions github-actions bot added the local testing Local Testing issues/PRs label Oct 4, 2024
@sfc-gh-aalam sfc-gh-aalam changed the base branch from main to aalam-SNOW-1418523-make-internal-session-variables-thread-safe October 4, 2024 18:08
)
)
self._thread_store = (
threading.local() if self._thread_safe_session_enabled else dict()
Copy link
Collaborator

Choose a reason for hiding this comment

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

instead of dict, maybe just use optional here, and only use the _thread_store value if the parameter is on

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would then have to create something like __analyzer and __conn since the _analyzer is already created as a property now. I think since we have tests passing, it should be okay. I am using a DummyThreadLocal class now. Everything will be removed once I rollout parameter.

@sfc-gh-aalam sfc-gh-aalam changed the title Snow 1720835 param protect client side changes SNOW-1720835 param protect thread-safe client side changes Oct 4, 2024
@sfc-gh-aalam sfc-gh-aalam marked this pull request as ready for review October 5, 2024 00:50
Copy link

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

Copy link

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

Copy link

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

Copy link

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

Copy link

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

Copy link

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

@@ -32,6 +35,21 @@
from tests.utils import IS_IN_STORED_PROC, IS_LINUX, IS_WINDOWS, TestFiles, Utils


@pytest.fixture(scope="module")
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's use a function scope here to avoid messing with other tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

renamed to threadsafe_session. this would not mess with others, right?

@@ -32,6 +35,21 @@
from tests.utils import IS_IN_STORED_PROC, IS_LINUX, IS_WINDOWS, TestFiles, Utils


@pytest.fixture(scope="module")
def session(
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's call this mutlithread_session instead of session

Copy link

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

Copy link

Seems like your changes contain some Local Testing changes, please request review from @snowflakedb/local-testing

@sfc-gh-aalam sfc-gh-aalam enabled auto-merge (squash) October 17, 2024 00:20
@sfc-gh-aalam sfc-gh-aalam merged commit 367dd23 into main Oct 17, 2024
35 checks passed
@sfc-gh-aalam sfc-gh-aalam deleted the SNOW-1720835-param-protect-client-side-changes branch October 17, 2024 19:57
@github-actions github-actions bot locked and limited conversation to collaborators Oct 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
local testing Local Testing issues/PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants