-
Notifications
You must be signed in to change notification settings - Fork 463
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
Refactoring connection management #18684
Conversation
PR Changes
|
@@ -872,40 +869,30 @@ export class ObjectExplorerService { | |||
isDisconnect: boolean = false, | |||
): Promise<void> { | |||
await this.closeSession(node); | |||
const nodeUri = ObjectExplorerUtils.getNodeUri(node); | |||
const nodeUri = this.getNodeIdentifier(node); |
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.
update ObjectExplorerUtils.getNodeUri()
?
Do we have an issue for this? Would love to understand how "similar" two connections need to be to trigger this isse, maybe a before/after screenshot with the fix? |
(connectionCredentials as IConnectionProfile).profileName, | ||
if ((connectionProfile as IConnectionProfile).profileName) { | ||
this._sessionIdToNodeLabelMap.set( | ||
sessionIdResponse.sessionId, |
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 part appears to be one of the important changes. At a high level I can see why we want to use sessionId instead of server name but would love to see more detailed explanation of the before/after workfow. (Not necessarily in this PR)
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.
Yup, swapping everything to use the sessionId as the sole key was the main change that solidified some unexpected behavior in the OE.
Before this change, there was a mix of keys being used, some of which were not guaranteed to be unique. Examples include:
- STS-provided session ID (constructed using all properties)
- vscode-mssql-generated session ID that seemed like it was supposed to be the same as the STS-provided one, but wasn't always (constructed using four primary connection properties)
- OE nodePath
When trying to identify the correct tree node to update, it would store a node label mapping keyed on the server (not guaranteed to be unique among all connections), then later select a saved connection based on the matching server name; if you had multiple connections to the same server, it could end up selecting the wrong one (depending on ordering, IIRC), and expanding the wrong server in the tree (with the right underlying connection, IIRC).
After this change: everything is keyed on the STS sessionID and I'm hoping to remove the concept of a vscode sessionID entirely. It no longer matters how similar a connection is, if any property differs, then it's treated as a separate connection at both layers.
There are still some other cases I need to follow up with (e.g. what gets displayed if there are identical profile names or server + db combos), but this is an important first step.
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.
I'll add recordings of before/after the change
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.
Thanks for the detailed explanation!
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.
Thanks for the detailed explanation.
Can you update the js doc for this interface with some explanation? Something like this maybe
/**
* A unique session ID used for all requests within a connection sub-tree.
* All child nodes must use the same session ID when sending expand requests.
*/
export class CreateSessionResponse { | |
/** | |
* Unique Id to use when sending any requests for objects in the tree | |
* under the node | |
*/ | |
public sessionId: string; | |
} |
/** | |
* Unique ID to use when sending any requests for objects in the | |
* tree under the node | |
*/ |
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.
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.
LGTM overall, I'd say we might need do more manual testings next week just to make sure this change won't break any existing OE experience.
Agreed. I really wanted to get this in on the earlier side of a release cycle, but too many things were competing with my time when I wanted to get this PR out. The right call could be to hold this PR after the release branch splits so we can decide whether to take it as a port. |
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.
Thanks for the code cleanup. Left a comment about a jsdoc comment.
Fixes #18849
Before this change, there was a mix of keys being used, some of which were not guaranteed to be unique. Examples include:
STS-provided session ID (constructed using all properties)
vscode-mssql-generated session ID that seemed like it was supposed to be the same as the STS-provided one, but wasn't always (constructed using four primary connection properties)
OE nodePath
When trying to identify the correct tree node to update, it would store a node label mapping keyed on the server (not guaranteed to be unique among all connections), then later select a saved connection based on the matching server name; if you had multiple connections to the same server, it could end up selecting the wrong one (depending on ordering, IIRC), and expanding the wrong server in the tree (with the right underlying connection, IIRC).
After this change: everything is keyed on the STS sessionID and I'm hoping to remove the concept of a vscode sessionID entirely. It no longer matters how similar a connection is, if any property differs, then it's treated as a separate connection at both layers.
There are still some other cases I need to follow up with (e.g. what gets displayed if there are identical profile names or server + db combos), but this is an important first step.
Before:
416897517-20655331-d79c-4f6f-9010-f4fe4444920a.mp4
After:
connfix.mp4