spring-projects / spring-data-mongodb

Provides support to increase developer productivity in Java when using MongoDB. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.
https://spring.io/projects/spring-data-mongodb/
Apache License 2.0
1.62k stars 1.09k forks source link

Getting error "unrecognized getLastError mode: 1 at shard0001" on create/update/delete operations [DATAMONGO-1300] #2215

Closed spring-projects-issues closed 4 years ago

spring-projects-issues commented 9 years ago

Nestor Fedyk opened DATAMONGO-1300 and commented

In a sharded replica set with tagging based on data center, often when performing an operation, we see our data is being stored/updated/deleted, but are receiving a "getLastError" response that is unexpected.

org.springframework.dao.DataIntegrityViolationException: { "serverUsed" : "mongosserver:27017" , "ok" : 1 , "n" : 0 , "err" : "unrecognized getLastError mode: 1 at shard0001" , "code" : 79}; nested exception is com.mongodb.WriteConcernException: { "serverUsed" : "mongosserver:27017" , "ok" : 1 , "n" : 0 , "err" : "unrecognized getLastError mode: 1 at shard0001" , "code" : 79}

We are using the following configuration for mongo driver and write concern:

<mongo:mongo id="prodMongoDB" replica-set="localhost:27017,networked-mongos-address:27017">
       <mongo:options connections-per-host="4"
           threads-allowed-to-block-for-connection-multiplier="10"
           connect-timeout="10000"
           max-wait-time="10000"
           auto-connect-retry="true"
           socket-keep-alive="false"
           socket-timeout="30000"
           slave-ok="true"/>
   </mongo:mongo>
   <bean id="mongoDbClientWriteConcern" class="com.mongodb.WriteConcern"
       lazy-init="true">
       <constructor-arg type="int">
           <value>1</value>
       </constructor-arg>
       <constructor-arg value="30000" />
       <constructor-arg value="false" />
       <constructor-arg value="false" />
   </bean>

Affects: 1.8 GA (Gosling)

spring-projects-issues commented 9 years ago

Oliver Drotbohm commented

Is mongoDbClientWriteConcern actually used anywhere? I can't see it being referred to from the Mongo instance you declared

spring-projects-issues commented 4 years ago

Mark Paluch commented

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue