Skip to content

Conversation

@romange
Copy link
Collaborator

@romange romange commented Oct 23, 2025

The task is run during cpu idle periods. It starts refreshing the base after several days. During the updates there are two bases and only one that is currently active: expire_gen_id_

  1. The update process concludes when it reaches end of the traversal and it did not skip any values that should be updated.

  2. It skips values when it encounters expired times as it can not delete values in the scope of the task.

The task is run during cpu idle periods. It starts refreshing the base
after several days. During the updates there are two bases and only
one that is currently active: expire_gen_id_

1. The update process concludes when it reaches end of the traversal and
it did not skip any values that should be updated.

2. It skips values when it encounters expired times as it can not delete
values in the scope of the task.

Signed-off-by: Roman Gershman <[email protected]>
Comment on lines +38 to +40
bool is_second_precision() {
return precision_ == 1;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
bool is_second_precision() {
return precision_ == 1;
}
bool is_second_precision() const {
return precision_ == 1;
}

if (update_expire_state_->db_index >= db_slice.db_array_size()) {
if (update_expire_state_->stale_entries == 0) {
// We went over all the items and not stale items were found, we are done.
delete update_expire_state_;
Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't followed the logic of this function completely but this seems dangerous if the state is kept among different idle runs of this function. Why ? Because:

  1. IdleTsk runs -> allocates update_expire_state_
  2. We exit so we don't run the task again
  3. Memory leak since we don't call delete update_expire_state_ anywhere else

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

IdleTask exits only on process shutdown. if it concludes the traversal, it deletes the state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants