Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

CSHARP-3984: Remove BinaryConnection.DropBox. #723

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

Closed
DmitryLukyanov wants to merge 3 commits into mongodb:master from DmitryLukyanov:csharp3984

Conversation

@DmitryLukyanov
Copy link
Contributor

@DmitryLukyanov DmitryLukyanov commented Jan 26, 2022

No description provided.

Copy link
Contributor

@rstam rstam left a comment

Choose a reason for hiding this comment

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

Nice to see it wasn't hard to remove the Dropbox!

Minor changes requested.

var receivedResponseTo = GetResponseTo(message);
if (receivedResponseTo != responseTo)
{
throw new InvalidOperationException($"The received responseTo {receivedResponseTo} doesn't match with expected {responseTo}."); // should not be reached
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we word the message more like many other messages we already have?

throw new InvalidOperationException($"Expected responseTo to be {responseTo} but was {receivedResponseTo}."); // should not be reached

Copy link
Contributor Author

@DmitryLukyanov DmitryLukyanov Jan 26, 2022

Choose a reason for hiding this comment

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

done


int GetResponseTo(IByteBuffer message)
{
var backingBytes = message.AccessBackingBytes(8);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it should be:

message.AccessBackingBytes(4);

Not 8.

Copy link
Contributor

@JamesKovacs JamesKovacs Jan 26, 2022

Choose a reason for hiding this comment

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

The argument to AccessBackingBytes is the offset into the message, not the number of bytes to read. responseTo is 8 bytes into the message header. So message.AccessBackingBytes(8) looks correct to me.

struct MsgHeader {
 int32 messageLength; // total message size, including this
 int32 requestID; // identifier for this message
 int32 responseTo; // requestID from the original request
 // (used in responses from db)
 int32 opCode; // request type - see table below for details
}

https://docs.mongodb.com/manual/reference/mongodb-wire-protocol/#standard-message-header

DmitryLukyanov reacted with rocket emoji
Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch!

Sorry for the mis-direction.

Copy link
Contributor Author

@DmitryLukyanov DmitryLukyanov Jan 26, 2022

Choose a reason for hiding this comment

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

nice find @JamesKovacs !

Copy link
Contributor

@JamesKovacs JamesKovacs left a comment

Choose a reason for hiding this comment

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

LGTM


int GetResponseTo(IByteBuffer message)
{
var backingBytes = message.AccessBackingBytes(8);
Copy link
Contributor

@JamesKovacs JamesKovacs Jan 26, 2022

Choose a reason for hiding this comment

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

The argument to AccessBackingBytes is the offset into the message, not the number of bytes to read. responseTo is 8 bytes into the message header. So message.AccessBackingBytes(8) looks correct to me.

struct MsgHeader {
 int32 messageLength; // total message size, including this
 int32 requestID; // identifier for this message
 int32 responseTo; // requestID from the original request
 // (used in responses from db)
 int32 opCode; // request type - see table below for details
}

https://docs.mongodb.com/manual/reference/mongodb-wire-protocol/#standard-message-header

DmitryLukyanov reacted with rocket emoji
Copy link
Contributor

@rstam rstam left a comment

Choose a reason for hiding this comment

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

LGTM

{
var timeout = TimeSpan.FromSeconds(30);
var cluster = __cluster.Value;
if (!SpinWait.SpinUntil(() => cluster.Description.Servers.Any(s => s.Type == ServerType.ReplicaSetPrimary), timeout))
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't what the name of the property says...

We should either change the name of the property or spin until the cluster is fully connected (presumably that means that the status of every server in the cluster is "connected").

Copy link
Contributor

Choose a reason for hiding this comment

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

This might be stretching the definition of what a property normally does. Properties normally do almost zero work and return quickly.

Maybe this should be a method (or several):

var cluster = DriverTestConfiguration.GetClusterWithConnectedPrimary();
var cluster = DriverTestConfiguration.GetClusterWithConnectedSecondary();
var cluster = DriverTestConfiguration.GetFullyConnectedCluster();

Copy link
Contributor Author

temporary close this PR since we found unexpected behavior and due to low priority of this ticket

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@rstam rstam rstam requested changes

@JamesKovacs JamesKovacs JamesKovacs approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /