Skip to content

TTL resets to 365 on every restart #74

@elfeffe

Description

@elfeffe

It reset EventTime index in MongoDB to 365 days no matter the TTL that you set.
I have a TTL of 4 years

{
"engineId": "purchase",
"dataset": {
"ttl": "1460 days",
},
"engineFactory": "com.actionml.engines.ur.UREngine",
"sparkConf": {
"master": "local",
"spark.driver-memory": "30g",
"spark.executor-memory": "30g"
},
"algorithm": {
"indicators": [
{
"name": "purchase"
},
{
"name": "view"
}
]
}
}

But it resets to 365 days on every restart.
The index exists, I even set by hand in MongoDB to 4 years, but when I restart, it changes the index to 365 days.

I can see in the logs the following:

09:36:41.458 INFO  MongoAsyncDao     - Drop index eventTime
09:36:41.556 INFO  MongoAsyncDao     - Create indexes List(Document((eventTime,BsonInt32{value=-1})) - IndexOptions{background=true, unique=false, name='eventTime', sparse=false, expireA$

Why it drop the index eventTime every time?

I see it checks:
case (iName, SingleIndex(o, isTtl), _) if isTtl && actualTtl(iName, actualIndexesInfo).forall(_.compareTo(ttl) != 0) =>

So if I set a different index ttl by hand using MongoDB GUI, it can believe TTL is different, and then drop it to recreate.

The thing is that I set TTL to 4 years in seconds on MongoDB, and then TTL in days on the config JSON file.
Can there be some small difference in seconds that oblige it to drop&recreate?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions