MongoDB---Appear no write has been do on this connection solution

Source: Internet
Author: User

No write has been do on this connection

The problem arose for several days. Dozens of times a day in the log no write has beendo on this connection,

So study for several days.

The operation of the program is to throw GetLastError when a problem occurs.

And then went through the GetLastError method, W has a few values,

1: Any one server can finish the next operation.

2:2 units must be completed.

0: Do not consider write completion or not, continue to write operations.

One more value is majority. After viewing the official documentation, I understand that values greater than 2 are majority. Here's an official explanation.

These are the official explanations for several parameters.

There is also a value of j,true,false,true to turn on logging.

For example, w:1,j:true, you must have a server write operation completed, and write the operation into journal before you can proceed to the next step.

As you can see in the figure, you must finish writing journal to return a valid value.

From the Red Line section, it can be seen that majority will replace the number greater than 2,

Back to the topic, reported that mistake, and finally found that the issue of the version. We can verify that, on 2.2, a remove operation on an empty collection, and then immediately enter GetLastError (W:1), will return the error of the problem, but on 2.6, it will not.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.