RocketChat / Rocket.Chat

The communications platform that puts data protection first.
https://rocket.chat/
Other
40.62k stars 10.63k forks source link

Error while creating index #28354

Open dolohow opened 1 year ago

dolohow commented 1 year ago

Description:

Error after upgrading from 5.4.4 to 6.0.0 on application startup

Server Setup Information:

Relevant logs:


Error creating index: livechat_priority -> { name: 1 } {                                                    [98/105]
  unique: true,                                                                                                     
  partialFilterExpression: { '$and': [ [Object], [Object] ] }                                                       
} MongoServerError: An existing index has the same name as the requested index. When index names are not specified, 
they are auto generated and can cause conflicts. Please refer to our documentation. Requested index: { v: 2, unique:
 true, key: { name: 1 }, name: "name_1", partialFilterExpression: { $and: [ { name: { $exists: true } }, { name: { $
gt: "" } } ] } }, existing index: { v: 2, unique: true, key: { name: 1 }, name: "name_1" }                          
    at Connection.onMessage (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/
cmap/connection.js:230:30)                                                                                          
    at MessageStream.<anonymous> (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/cmap/connection.js:61:60)                                                                                      
    at MessageStream.emit (events.js:400:28)                                                                        
    at MessageStream.emit (domain.js:475:12)                                                                        
    at processIncomingData (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/c
map/message_stream.js:125:16)                                                                                           at MessageStream._write (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/
cmap/message_stream.js:33:9)                                                                                        
    at writeOrBuffer (internal/streams/writable.js:358:12)                                                          
    at MessageStream.Writable.write (internal/streams/writable.js:303:10)
    at Socket.ondata (internal/streams/readable.js:731:22)                                                          
    at Socket.emit (events.js:400:28)                                                                                   at Socket.emit (domain.js:475:12)                                                                               
    at addChunk (internal/streams/readable.js:293:12)                                                               
    at readableAddChunk (internal/streams/readable.js:267:9)                                                        
    at Socket.Readable.push (internal/streams/readable.js:206:10)                                                   
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
    at TCP.callbackTrampoline (internal/async_hooks.js:130:17) {                          
  ok: 0,      
  code: 86,
  codeName: 'IndexKeySpecsConflict',
  '$clusterTime': {
    clusterTime: new Timestamp({ t: 1678436209, i: 3 }),
    signature: {
      hash: new Binary(Buffer.from("0000000000000000000000000000000000000000", "hex"), 0),
      keyId: 0
    }
  },
  operationTime: new Timestamp({ t: 1678436209, i: 3 }),
  [Symbol(errorLabels)]: Set(0) {}
}
mranderson56 commented 1 year ago

Hi @dolohow ! Did you set the correct feature compatibility in mongodb ? -> db.adminCommand( { setFeatureCompatibilityVersion: "5.0" } )

dolohow commented 1 year ago

The issue also happened on 5.0, later I upgraded to 6.0 and it still there.

Anyway 5.0 was a freeh cluster so feature compatibility should be there. I'll double check later.

dolohow commented 1 year ago

I have 6.0 and currently I have, while running 6.0.4. Issue is present.

db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )
{
  featureCompatibilityVersion: { version: '5.0' },
  ok: 1,
  '$clusterTime': {
    clusterTime: Timestamp({ t: 1678448947, i: 1 }),
    signature: {
      hash: Binary(Buffer.from("0000000000000000000000000000000000000000", "hex"), 0),
      keyId: Long("0")
    }
  },
  operationTime: Timestamp({ t: 1678448947, i: 1 })
}
dotty37 commented 1 year ago

Im having the same problems as the OP.

luigi-bellio commented 1 year ago

Same problem at first boot ... the error disappeared on the second boot.

lyz-code commented 1 year ago

Same issue for us, and I reproduce the error disappearance on the second boot.

The site doesn't load though (although it may be for other errors shown in the log)

murtaza98 commented 1 year ago

Hi, I think this error is likely harmless and you should not worry about it ;) Did the server happen to crash because of this?

Couple of points related to this change since this was a major one:

langfingaz commented 12 months ago

As described in https://github.com/RocketChat/Rocket.Chat/issues/29614#issuecomment-1693805378, this can be resolved with: