[ 
https://issues.apache.org/jira/browse/HDDS-4651?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Shashikant Banerjee closed HDDS-4651.
-------------------------------------
    Assignee: Glen Geng  (was: Rui Wang)

> Implement Distributed Sequence ID Generator 
> --------------------------------------------
>
>                 Key: HDDS-4651
>                 URL: https://issues.apache.org/jira/browse/HDDS-4651
>             Project: Apache Ozone
>          Issue Type: Sub-task
>            Reporter: Rui Wang
>            Assignee: Glen Geng
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.1.0
>
>
>  
>  * 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:



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to