lichess-org / lila

♞ lichess.org: the forever free, adless and open source chess server ♞
https://lichess.org
GNU Affero General Public License v3.0
15.14k stars 2.24k forks source link

onboarding: seenAt index for challenges appears to be mandatory #6758

Closed niklasf closed 4 years ago

niklasf commented 4 years ago

it appears that

db.challenge.ensureIndex({seenAt:1},{partialFilterExpression:{status:10,timeControl:{$exists:true},seenAt:{$exists:true}}})

is now (24c26f9b3ac2f59914bd75625d93b957f7000a2b) a required installation step.

otherwise:

reactivemongo.core.errors.DatabaseException$$anon$1: DatabaseException['error processing query: ns=lichess.challenge limit=50Tree: $and
    status $eq 10
    seenAt $lt new Date(1591169796612)
    timeControl exists
Sort: {}
Proj: {}
 planner returned error :: caused by :: hint provided does not correspond to an existing index' (code = 2)]
    at reactivemongo.core.errors.DatabaseException$.apply(errors.scala:87)
    at reactivemongo.core.protocol.ResponseDecoder.failed$1(ResponseDecoder.scala:95)
    at reactivemongo.core.protocol.ResponseDecoder.response$1(ResponseDecoder.scala:124)
    at reactivemongo.core.protocol.ResponseDecoder.decode(ResponseDecoder.scala:143)
    at reactivemongo.core.protocol.ResponseDecoder.decode(ResponseDecoder.scala:21)
    at reactivemongo.io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88)
    at reactivemongo.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
    at reactivemongo.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
    at reactivemongo.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
    at reactivemongo.io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:316)
[error] reactivemongo.api.Cursor - fails to send request

local mongodb version: v4.2.6

should this be added (maybe as a script) to the onboarding guide, or can it be made optional?

mtvec commented 3 years ago

I'm seeing a very similar error again:

[error] reactivemongo.api.Cursor - Fails to send request
reactivemongo.core.errors.DatabaseException$$anon$1: DatabaseException['error processing query: ns=lichess.challenge limit=50Tree: $and
    status $eq 10
    seenAt $lt new Date(1620746183676)
    timeControl exists
Sort: {}
Proj: {}
 planner returned error: bad hint' (code = 2)]

Should I open a new issue for this?

ornicar commented 3 years ago

https://github.com/ornicar/lila/wiki/Lichess-Development-Onboarding#create-database-indexes

mtvec commented 3 years ago

@ornicar Thanks! However, the file bin/mongo/indexes.js doesn't seem to exist (anymore?). In fact, the directory mongo doesn't exist, but mongodb does:

$ ls bin/mongodb/*index*
bin/mongodb/clas_index.js
bin/mongodb/study-topic-index.js
bin/mongodb/export-indexes.js
bin/mongodb/tournament-team-indexes.js

Is it one of those I have to use?

niklasf commented 3 years ago

Fixed path to bin/mongodb/indexes.js in the Wiki. git pull to update to the latest commit, which should have the new indexes.js script.

mtvec commented 3 years ago

@niklasf Thanks, everything works perfectly now.