Skip to content

mc_worker_logic:make_request was being called with the wrong DB#217

Open
stephb9959 wants to merge 1 commit into
comtihon:masterfrom
stephb9959:master
Open

mc_worker_logic:make_request was being called with the wrong DB#217
stephb9959 wants to merge 1 commit into
comtihon:masterfrom
stephb9959:master

Conversation

@stephb9959

Copy link
Copy Markdown

Although the code was properly figuring out the right DB, it would always pass the Connection DB to the make_request.

…ys called with the connection DB instead of the possible DB as a parameter.
@comtihon

comtihon commented Sep 2, 2019

Copy link
Copy Markdown
Owner

Hi,
Can you please fix the tests?

@stephb9959

stephb9959 commented Sep 3, 2019 via email

Copy link
Copy Markdown
Author

@comtihon

comtihon commented Sep 3, 2019

Copy link
Copy Markdown
Owner

Hi,
mc_worker checks only ok when sending ensure index request.

{ok, _, _} =
    mc_worker_logic:make_request(
      Socket,
      NetModule,
      ConnState#conn_state.database,
      #insert{collection = mc_worker_logic:update_dbcoll(Coll, <<"system.indexes">>), documents = [Index]}),

mongo_api:ensure_index doesn't send anything to the database. It just prepares the request. You can rename it in this pr, if you find it confusing.

As far as I remember you always pass authentication against the specific database, so you can't just switch database in the same connection.
I am not talking about creating a new test, but all the old tests are failing for some reason. Although I am not sure it is because of your changes, as the latest master is also red.

@stephb9959

stephb9959 commented Sep 3, 2019 via email

Copy link
Copy Markdown
Author

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants