Skip to content
This repository was archived by the owner on Feb 4, 2022. It is now read-only.

Pin Servers during Sharded Transactions #411

Merged
merged 12 commits into from
Feb 27, 2019

Conversation

daprahamian
Copy link
Contributor

Changes to ensure that all commands in a sharded transaction run against a single mongos.

Items to still do:

  • Ensure that pins are released at the appropriate times
  • Add support for new SDAM layer

@daprahamian daprahamian force-pushed the NODE-1743/pin-sharded-transactions branch from dc3ef29 to e4f1af7 Compare February 22, 2019 21:25
@mbroadst mbroadst force-pushed the NODE-1743/pin-sharded-transactions branch from 6bd55c7 to 9a63109 Compare February 23, 2019 02:26
@daprahamian daprahamian force-pushed the NODE-1743/pin-sharded-transactions branch from 9a63109 to 8e0c9f9 Compare February 25, 2019 01:54
@daprahamian daprahamian changed the title WIP: Pin Servers during Sharded Transactions Pin Servers during Sharded Transactions Feb 25, 2019
@mbroadst mbroadst force-pushed the NODE-1743/pin-sharded-transactions branch from a466b0c to 5db3c1b Compare February 25, 2019 23:25
@daprahamian daprahamian force-pushed the NODE-1743/pin-sharded-transactions branch from 5db3c1b to 01a2fa8 Compare February 26, 2019 22:55
@mbroadst mbroadst force-pushed the NODE-1743/pin-sharded-transactions branch from 204d313 to dc02410 Compare February 27, 2019 13:19
@mbroadst mbroadst force-pushed the NODE-1743/pin-sharded-transactions branch from 03de14a to 2ae6b4f Compare February 27, 2019 14:15
const session = options.session;
const transaction = session && session.transaction;

if (isSharded && transaction && transaction.server) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

mongos.js has a protection here to ensure that the pinned server is actually connected. Should we do that here?

Copy link
Member

Choose a reason for hiding this comment

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

I think that's because the old mongos doesn't have proper server selection. Anyway, I think it's too defensive to check here and I'd rather fix this holistically in our new topology if the issue comes up.

return;
}

throw new MongoError(
`Attempted illegal state transition from [${this.state}] to [${nextState}]`
);
}

get isPinned() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

it looks like get isPinned is defined twice here, and not actually used.

Copy link
Member

Choose a reason for hiding this comment

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

whoops, removing

@mbroadst mbroadst merged commit 37ebcb9 into master Feb 27, 2019
@mbroadst mbroadst deleted the NODE-1743/pin-sharded-transactions branch February 27, 2019 17:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants