Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-26832

Bring the many 'copied' task trigger mechanisms into the task API

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • None
    • master
    • couchbase-bucket

    Description

      Loosely related to MB-26831

      A number of tasks exist which have similar trigger mechanisms,

      • BgFetcher::run(GlobalTask *task)
      • ItemPager::run
      • ActiveStreamCheckpointProcessorTask::run

      The atomic 'notified' logic should be moved up to a base-class (maybe GlobalTask) along with the wake mechanism, then the task's run function can be 'wrapped' in GlobalTask run who performs the common steps which exist to prevent lost wakeups.

      bool BaseTask::run() {
        snooze(INT_MAX);
        notified = false;
        bool rv = derived::run();
        if (derived::moreWork()) {  // note derived::moreWork would check the queue in ActiveStreamCheckpointProcessorTask
           wakeUp();
        }
        return rv;
      }
      

      We can also consider a way to clearly implement/separate triggered tasks from periodic tasks with some restructuring of GlobalTask->PeriodicTask->*Task

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              mohammad.zaeem Mohammad Zaeem
              jwalker Jim Walker
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty