Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expires Redis Keys based on Feature Table Max Age #1161

Merged
merged 4 commits into from
Nov 24, 2020

Conversation

khorshuheng
Copy link
Collaborator

@khorshuheng khorshuheng commented Nov 13, 2020

Signed-off-by: Khor Shu Heng khor.heng@gojek.com

What this PR does / why we need it:
Since the release of Feast 0.8, the Redis ingestion is performed via Spark ingestion module rather than the existing Redis storage module. Hence, #955 is not applicable to Feast 0.8.

For the current implementation, instead of a global value of ttl which would be applicable to all Redis key, the ttl will be computed based on the max ages of all the feature tables associated with the Redis Key. For example, if two feature table are associated with the Redis key, the ttl will be computed as follows:

ttl = max(event_timestamp_feature_table_1 + max_age_feature_table_1, event_timestamp_feature_table_2 + max_age_feature_table_2) - current time

In the event where any of the feature table associated with the Redis key has max age set to 0, ttl will not be set.

Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?:

After this PR, the key stored on Redis will be deleted when it is older than event_timestamp + max age, unless the key is also associated with another feature table where max age is not specified, or the expiry time is in the future.

@woop
Copy link
Member

woop commented Nov 14, 2020

/retest

@khorshuheng khorshuheng force-pushed the redis-key-ttl branch 2 times, most recently from 87c7ec5 to c537690 Compare November 17, 2020 02:14
@khorshuheng khorshuheng force-pushed the redis-key-ttl branch 2 times, most recently from f1a496b to c537690 Compare November 17, 2020 05:37
@khorshuheng khorshuheng changed the title (WIP) Expires Redis Keys based on Feature Table Max Age Expires Redis Keys based on Feature Table Max Age Nov 17, 2020
@khorshuheng khorshuheng added the kind/feature New feature or request label Nov 17, 2020
@woop
Copy link
Member

woop commented Nov 18, 2020

@khorshuheng can you please add a description? This PR has no information.

How does this fit into what @ravdin is doing in #955?

@khorshuheng khorshuheng changed the title Expires Redis Keys based on Feature Table Max Age (WIP) Expires Redis Keys based on Feature Table Max Age Nov 19, 2020
Signed-off-by: Khor Shu Heng <khor.heng@gojek.com>
@khorshuheng khorshuheng changed the title (WIP) Expires Redis Keys based on Feature Table Max Age Expires Redis Keys based on Feature Table Max Age Nov 20, 2020
}

override def newExpiryTimestamp(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not really persistence related method. Maybe move it to RedisSinkRelation?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can move MAX_EXPIRED_TIMESTAMP to package level

…edisSinkRelation

Signed-off-by: Khor Shu Heng <khor.heng@gojek.com>
keyTTL should (be <= (r.getEventTimestamp.getSeconds + maxAge - ingestionTimeUnix / 1000) and be > 0L)
}

val increasedMaxAge = 86400 * 2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have test for max age = 0 instead, since this flow was already tested with Batch Pipeline?

@woop
Copy link
Member

woop commented Nov 23, 2020

In the event where any of the feature table associated with the Redis key has max age set to 0, ttl will not be set.

So how does an administrator force a TTL?

Signed-off-by: Khor Shu Heng <khor.heng@gojek.com>
Signed-off-by: Khor Shu Heng <khor.heng@gojek.com>
@pyalex
Copy link
Collaborator

pyalex commented Nov 24, 2020

/test test-end-to-end-gcp

@feast-ci-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: khorshuheng, pyalex

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@pyalex
Copy link
Collaborator

pyalex commented Nov 24, 2020

/lgtm

@feast-ci-bot feast-ci-bot merged commit 60b568d into feast-dev:master Nov 24, 2020
pyalex pushed a commit that referenced this pull request Nov 24, 2020
* Expires Redis Keys based on Feature Table Max Age

Signed-off-by: Khor Shu Heng <khor.heng@gojek.com>

* Remove redundant generics, move expiry eventimestamp computation to RedisSinkRelation

Signed-off-by: Khor Shu Heng <khor.heng@gojek.com>

* Persist the key if the expiry date is equal to max timestamp

Signed-off-by: Khor Shu Heng <khor.heng@gojek.com>

* Add more test cases

Signed-off-by: Khor Shu Heng <khor.heng@gojek.com>

Co-authored-by: Khor Shu Heng <khor.heng@gojek.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants