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

Implement Distributed Sequence ID Generator

Attach filesAttach ScreenshotVotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2.0
    • Component/s: 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

            • Assignee:
              glengeng Glen Geng
              Reporter:
              amaliujia Rui Wang

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment