[ 
https://issues.apache.org/jira/browse/RATIS-279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16639252#comment-16639252
 ] 

Sergey Soldatov commented on RATIS-279:
---------------------------------------

bq. Overall looks good. 
Well. I have some questions. 
{code}
LogService logService = 
LogServiceFactory.getInstance().createLogService(raftClient);
{code}
Qs: What is this LogService? Is it client  that performs all operations? If so, 
why we need a factory for that and why we shuld provide raftClient? How we 
would create that raftClient in the real world? What is the groupId? What are 
the peers?
{code}
LogStream logStream = logService.createLog(logName);
{code}
Qs: Well, we create a log. Where? On the current quorum? Or we create a log in 
the state machine? 
{code}
logService.getLog(logName);
assertEquals("log1", logStream.getName().getName());
{code}
Qs: We get the log. What does that mean? And how it's related to the next 
assertion? 
{code}
logStream = logService.listLogs().next();
{code}
Qs: Well, yet agaion - what is the LogService. Is it a client? Is it a service 
(according to the name it's a service, but well, where is the client in that 
case???).

Now about the state machine. I don't understand how it's supposed to work in 
the real world. What are those requests 'createLog', 
'deleteLog' ? What it should do in the state machine? At the beginning (when 
there are literally nothing in the RaftServer) we create a raft group and the 
corresponding StateMachine. And this pair {color:red}is{color} the Log 
implementation where we may write and read. I can understand operations like 
getState or close. But completely don't understand createLog, listLogs. Those 
operations just don't belong to the Log. They are the part of the meta data 
operations.
IMHO the operations with log(s) should look like:
{code}
LogServiceAdmin admin = 
LogServiceAdmin.newBuilder().setMasterQuorum("host1:9999,host2:9999,host3:9999).build();
Log log1 = admin.createLog("log1");
try {
  Log log2 = admin.getLog("log2"); 
 } catch(LogNotFoundException e) { 
....
}
LogReadStream readStream = log1.getReadStream();
LogWriteStream writeStream = log1.getWriteStream();
//or 
log1.append(message);
log1.readAt(100);
log1.getLength();
{code}
And what actually would happen inside of admin.createLog("log1") (that's the 
part of the code I'm working on) :
1. create the raft client for 'meta' quorum
2. send the message 'createLog' to 'meta' quorum. 'meta' state machine:
   a.  find 3 (or n) free available RaftServers (peers)
   b. create RaftGroup 'rg' with those  peers and unique RaftGroupId 'rgi'
   c. call for each of those peers: clientPeer.groupAdd(rg, peer)
   d. create a client for each of those peers with the rgi group id and call 
clientPeer2.setConfiguration(peers)
   e. wait for the leader election in the new quorum
   f. persist the map between log name and 'rg' (that would be used for 
'getLog' calls)
   g. returns 'rg' back 
3. Log 'log1' stores 'rg' internally as well as creates the raft client that 
would read/write from this quorum (and that's the raft client from your code)  

> Create administrative API for a log stream
> ------------------------------------------
>
>                 Key: RATIS-279
>                 URL: https://issues.apache.org/jira/browse/RATIS-279
>             Project: Ratis
>          Issue Type: Sub-task
>          Components: LogService
>            Reporter: Josh Elser
>            Assignee: Rajeshbabu Chintaguntla
>            Priority: Major
>         Attachments: RATIS-279_WIP.patch, RATIS-279_v2.patch, 
> RATIS-279_v3.patch, RATIS-279_v4.patch, RATIS-279_v5.patch
>
>
> We need to do basic things like:
>  * List all log streams
>  * Delete a log stream
>  * Truncate a log stream
> This may overlap with functionality that actually should live in HBase. 
> Making that distinction is part of the tasks of this issue.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to