Uploaded image for project: 'Apache Ozone'
  1. Apache Ozone
  2. HDDS-2823 SCM HA Support
  3. HDDS-4651

Implement Distributed Sequence ID Generator

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.2.0
    • None

    Description

       

      • SCM allocates ids in a batch way. It maintains three fields: firstId, lastId and nextId. It saves the lastId in rocksDB, saves firstId and lastId in memory. The initial value of nextId is firstId.
      • When getNextId() is called, if nextId is less than lastId, SCM just returns nextId and increases it, otherwise it calls allocateBatch(expectedLastId, newLastId) to allocate a batch of ids, then serves the request.
      • In allocateBatch(expectedLastId, newLastId) , it works in CAS way:
      • it reads lastId from rocksDB.
      • if lastId equals expectedLastId, it saves newLastId into rocksDB, returns success, otherwise it rejects the allocation request.
      • It also provides a getLastId() to read lastId from rocksDB. The allocation works in a loop way:

      Attachments

        Activity

          People

            glengeng Glen Geng
            amaliujia Rui Wang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: