rocksdb icon indicating copy to clipboard operation
rocksdb copied to clipboard

Fix periodic_task unable to re-register the same task type

Open jay-zhuang opened this issue 2 years ago • 1 comments

Timer has a limitation that it cannot re-register a task with the same name, because the cancel only mark the task as invalid and wait for the Timer thread to clean it up later, before the task is cleaned up, the same task name cannot be added. Which makes the task option update likely to fail, which basically cancel and re-register the same task name. Change the periodic task name to a random unique id and store it in periodic_task_scheduler.

Also refactor the periodic_work to periodic_task to make each job function as a task.

Test Plan: unittests

jay-zhuang avatar Jul 18 '22 01:07 jay-zhuang

@jay-zhuang has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot avatar Jul 20 '22 16:07 facebook-github-bot

@jay-zhuang has updated the pull request. You must reimport the pull request before landing.

facebook-github-bot avatar Aug 25 '22 22:08 facebook-github-bot

@jay-zhuang has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot avatar Aug 25 '22 22:08 facebook-github-bot

@jay-zhuang has updated the pull request. You must reimport the pull request before landing.

facebook-github-bot avatar Aug 25 '22 23:08 facebook-github-bot

@jay-zhuang has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot avatar Aug 25 '22 23:08 facebook-github-bot

@jay-zhuang has updated the pull request. You must reimport the pull request before landing.

facebook-github-bot avatar Aug 25 '22 23:08 facebook-github-bot

@jay-zhuang has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot avatar Aug 25 '22 23:08 facebook-github-bot