Hi Christopher,
What is the name of your project ? We'll go in and see what's causing the issue and point you in the right direction. How big is the collection you are trying to index ?
Thanks,
Liam
The API key is ***********
The index creation command is
Spark.runtimeCollection("kmHexGroup").ensureIndex({'dirty' : 1}, {'name': 'dirty'});
FYI I think the index created, however the termination of the script might keep the other commands in GS_GAME_PUBLISH from occurring, not 100% certain as this was the last command.
Hi Christopher,
I have removed your api key for security reasons. I took a look at the script in your game and can see you are requiring some modules in this scrip along with the indexing. Can you talk us through what you are trying to achieve here ?
Thanks,
Liam
Hi Liam,
The require() is a basic wrapper around Spark().runtimeCollection(). Nothing more.
We are using GamePublish for index creation, and seeding initial values. This was based off the following recommendation:
However the 'dirty' index was operating on a very large dataset and gave that error.
Chris
Hi Chris,
Apologies for the delayed response. I don't see the "kmHexGroup" collection in your game. Has it since been removed ?
Thanks,
Liam
Hi Chris,
Is this issue still outstanding for you?
If there is anything we can do to assist, please let us know.
Regards,
-Dave
Hi sorry, didn't see the update. The kmHexGroup collection is still there. Look in the Live instance of API key: ***********
bump
Hi Christopher,
Apologies for the delay.
The team is looking into this and will get back to you.
Thanks,
Oisín.
Hi Christopher,
I believe this timeout may have been caused by the index creation. The 'kmHexGroup' is quite large, and as a result, building an index for it would take some time. From the mongo documentation:
"When building an index on a collection, the database that holds the collection is unavailable for read or write operations until the index build completes."
Have you tried calling ensureIndex with background:true? This way it will take longer to build, but should leave the db open for other operations.
Regards,
Vinnie
Hi,
I'm not worried about how long it takes on the DB side. I'm worried about the GS_GAME_PUBLISH action not completing because the script times out (the 30 seconds timeout is from GameSpark). If we have multiple index creations in this script, then the script will fail to execute the others due to timeout.
According to their documentation, background = true will still block the ensureIndex command:
https://docs.mongodb.com/manual/core/index-creation/
Background indexing operations run in the background so that other database operations can run while creating the index. However, the mongo shell session or connection where you are creating the index will block until the index build is complete. To continue issuing commands to the database, open another connection or mongo instance.
bump
Hi Christopher,
Do you mind if I convert this post to a ticket?
It's a better way to keep track of this issue for you.
One of the team will get back to you regarding this issue in the morning.
Thanks,
Oisín
Go ahead!
Christopher Stewart
Hi,
We're trying to create an index on a large database. The index creation is in GS_GAME_PUBLISH. We got the following error:
{
"script": "GS_GAME_PUBLISH",
"log": {
"stackTrace": "\tat modules/Db.js:34\n\tat systemModules/GS_GAME_PUBLISH.js:10\n",
"error": {
"errorString": "Long running script, terminating after 30000 millis for GS_GAME_PUBLISH"
},
"script": "GS_GAME_PUBLISH"
},
"level": "FATAL",
"ts": 1478637997464
}
Can GS_GAME_PUBLISH be made to not time out?