You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Flavio Junqueira (JIRA)" <ji...@apache.org> on 2011/02/22 23:46:38 UTC

[jira] Created: (ZOOKEEPER-1001) Read from open ledger

Read from open ledger
---------------------

                 Key: ZOOKEEPER-1001
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
             Project: ZooKeeper
          Issue Type: New Feature
          Components: contrib-bookkeeper
            Reporter: Flavio Junqueira


The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.

It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ZOOKEEPER-1001) Read from open ledger

Posted by "Robert Chansler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13017525#comment-13017525 ] 

Robert Chansler commented on ZOOKEEPER-1001:
--------------------------------------------

Of course Flavio had the right answer in the first comment!

Now that is settled, I have one more question out of curiosity. When the ledger is closed, all bookies may have received record N, but the writing client may not have committed N by setting X.LC≥N for some other record X > N. Is N committed in the closed ledger? Sometimes? Always? Never?

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf, zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (ZOOKEEPER-1001) Read from open ledger

Posted by "Ivan Kelly (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009226#comment-13009226 ] 

Ivan Kelly commented on ZOOKEEPER-1001:
---------------------------------------

Ah, I thought you were going put those checks inside the client. i.e. Something like create a subclass of LedgerHandle, which puts a watcher on the lastConfirmed value and if the client tries to read past it, throw an exception. That does raise the issue of how do you see if new data becomes available. Perhaps you could have a watchLastAddConfirmed() call on LedgerHandle that triggers a callback when it comes available.

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf, zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (ZOOKEEPER-1001) Read from open ledger

Posted by "dhruba borthakur (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009233#comment-13009233 ] 

dhruba borthakur commented on ZOOKEEPER-1001:
---------------------------------------------

Thanks for the picture, Flavio. I like Option 2. The folowing two comments are for Option 2:

1. It would be nice to have the two parameters that Option 2 uses (the time or size after which ZK is updated) be configurable.

2. The diagram shows that the App1 periodically informs ZK about the last committed seqid.  Can this interaction be handled by the BK client itself (instead of the App). For example,BookKeeper.java  can have the following API:

{quote}
  public long createLedger(...., boolean updateZk)
{quite}

If updateZk is true, then the BookKeeper client itself will udpate zk with the last committed transaction at some given periodicity. This is similar in some sense to filesystems where the file-metadata becomes globally visible/readable after some time (even though the writer is continuing to write to the file).



> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf, zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (ZOOKEEPER-1001) Read from open ledger

Posted by "Robert Chansler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13015496#comment-13015496 ] 

Robert Chansler commented on ZOOKEEPER-1001:
--------------------------------------------

Thanks, Flavio, for your patient explanations!

I have one more question about reading while writing. If I ask a bookie for record M, either the bookie has the record or doesn't have the record. Regardless, the bookie has a greatest record N, and let X=N.lc. Now record N may not be committed, but record X _is_ committed. And so the bookie can return not only record M, if available, but also a flag indicating whether X≥M. If my bookie returns M but X<M, I can wait a little bit and ask again. If the writer agrees that the difference between N and N.lc is bounded, won't a reader with just a little patience (the expected time between M and N.lc≥M) continue to make progress? Making progress is the goal, not knowing the very last committed record. And you can't _know_ the _last_ committed record until the ledger is closed, in any case. 


> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf, zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (ZOOKEEPER-1001) Read from open ledger

Posted by "dhruba borthakur (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12999462#comment-12999462 ] 

dhruba borthakur commented on ZOOKEEPER-1001:
---------------------------------------------

I think ur proposal allows a concurrent reader to read all entries upto the pennultimate committed record from the ledger. This sounds fine for now.

On a related question: if the writer of the ledger dies a sudden death,  how long will it take after that event before the reader can read *all* the committed entries from that ledger?

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ZOOKEEPER-1001) Read from open ledger

Posted by "dhruba borthakur (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014944#comment-13014944 ] 

dhruba borthakur commented on ZOOKEEPER-1001:
---------------------------------------------

On a related question: is the writing of a ledger entry atomic (for a single bookie)? For example, if an application writes a ledger entry to a certain bookie and a concurrent reader tries to read that entry (even if that entry is not committed to all bookies), is it possible that only a part of that ledger entry is visible to the reader?

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf, zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (ZOOKEEPER-1001) Read from open ledger

Posted by "dhruba borthakur (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13010000#comment-13010000 ] 

dhruba borthakur commented on ZOOKEEPER-1001:
---------------------------------------------

Thanks Utkarsh.

Maybe, at a minimum, we could have a BK client side APi that accesses the znode and sets the metatadata. We can still keep the Bookie dumb and at the same time shield the app form directly using the znodes.

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf, zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (ZOOKEEPER-1001) Read from open ledger

Posted by "Flavio Junqueira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13017177#comment-13017177 ] 

Flavio Junqueira commented on ZOOKEEPER-1001:
---------------------------------------------

Hi Rob, No problem at all!

{quote}
If I ask a bookie for record M, either the bookie has the record or doesn't have the record. Regardless, the bookie has a greatest record N, and let X=N.lc. Now record N may not be committed, but record X is committed. And so the bookie can return not only record M, if available, but also a flag indicating whether X≥M. If my bookie returns M but X<M, I can wait a little bit and ask again. If the writer agrees that the difference between N and N.lc is bounded, won't a reader with just a little patience (the expected time between M and N.lc≥M) continue to make progress? Making progress is the goal, not knowing the very last committed record. And you can't know the last committed record until the ledger is closed, in any case. 
{quote}

Sure, we have an equivalent feature implemented in bookies today. If I send a request to some bookie to read an entry from a given ledger and the entry id is -1, it will return the id of the last committed write it knows about (we have called it confirmed writes so far, and not committed). The bookie learns of committed writes through regular writes, since one of the fields of the write request is the "last confirmed hint", which is the last confirmed entry the client writer has.

Using the hint is actually one of strategies I suggest in the very first post of this jira. I think it is a good approach too, and might simply require exposing it to the application.   


> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf, zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (ZOOKEEPER-1001) Read from open ledger

Posted by "Utkarsh Srivastava (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009998#comment-13009998 ] 

Utkarsh Srivastava commented on ZOOKEEPER-1001:
-----------------------------------------------

Dhruba, you bring up a good point. It's a broader issue with the whole BK design. The client is smart and the bookies are dumb. For Hedwig, this didn't bother me because the Hedwig servers were the BK clients, and the actual hedwig clients were insulated from all this ZK access. But for general BK clients, it might be better to have all this ZK access be done server side.

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf, zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (ZOOKEEPER-1001) Read from open ledger

Posted by "dhruba borthakur (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009992#comment-13009992 ] 

dhruba borthakur commented on ZOOKEEPER-1001:
---------------------------------------------

Hi Flavio and Utkarsh: I see your point. Do you really want a BK application to directly interact with ZK? Isn't it better if the znodes are all hidden behind a BK api, so that it is easy to upgrade to a possibly new layout in future without impacting BK clients?

is there any other reason why a BK api directly interacts with Znodes?

another option would be to wrap the Znode access via a seperate BK api.

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf, zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (ZOOKEEPER-1001) Read from open ledger

Posted by "dhruba borthakur (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12998501#comment-12998501 ] 

dhruba borthakur commented on ZOOKEEPER-1001:
---------------------------------------------

when a reader is reading data from a ledger that is being written to concurrently, it should be fine even if the reader reads uncommitted data (i.e. data that is not yet written to a quorum set of bookies). In fact, the reader can go to any bookie and query how many records it currently have, and then read all those records. This could mean that we do not need any notification mechanism between the writer and concurrent-readers.

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (ZOOKEEPER-1001) Read from open ledger

Posted by "dhruba borthakur (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13008738#comment-13008738 ] 

dhruba borthakur commented on ZOOKEEPER-1001:
---------------------------------------------

design looks good.

"For example, the writer may report 
every 10k writes or every minute, whichever happens first."

I like this. It would be nice if zk can up updated with the last committed record id in the ledger. Also, can we make these two parameters configurable?

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (ZOOKEEPER-1001) Read from open ledger

Posted by "Flavio Junqueira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13010591#comment-13010591 ] 

Flavio Junqueira commented on ZOOKEEPER-1001:
---------------------------------------------

Agreed, one main difficulty with updating ZK from bookies is that no bookie alone has all the information about a ledger, and bookies don't communicate with regular read/write protocol.

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf, zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (ZOOKEEPER-1001) Read from open ledger

Posted by "Robert Chansler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014857#comment-13014857 ] 

Robert Chansler commented on ZOOKEEPER-1001:
--------------------------------------------

Can a client reading an open ledger from bookie B ever be confident that it will see committed record N _short of the ledger being closed_? If the answer is No, then it seems that even if an oracle tells me that N is committed, then my reading client must survey a quorum of bookies to be certain of finding record N. And a survey of a quorum of bookies would also find the record that commits N, obviating the need for any oracle. If the answer is Yes, the reading client will see record N without the complexity of consulting the oracle if only the reader is a little patient.

Anyway, for HDFS, why not just start a new ledger every minute, and have the standby server only read from closed ledgers? (Sixty seconds of latency.)

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf, zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (ZOOKEEPER-1001) Read from open ledger

Posted by "Flavio Junqueira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009704#comment-13009704 ] 

Flavio Junqueira commented on ZOOKEEPER-1001:
---------------------------------------------

In ZOOKEEPER-462, Utkarsh was not really in favor of having the BK client updating ZK periodically, since he thought that it was a functionality that should be implemented by the application. I avoided this direction mostly due to those comments.

Now, discussing with Ivan earlier today, he gave a suggestion that I thought was interesting. He suggested that we could treat the CLOSED znode as checkpoint (and perhaps rename it) instead of updating it only at the end. That is, we could have a call that is something like "checkpoint but keep open", which essentially updates the CLOSED znode with the last committed operation, but it does not represent the end of the ledger. The application could update it as often as it wants. 

How do you feel about this approach?

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf, zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (ZOOKEEPER-1001) Read from open ledger

Posted by "Flavio Junqueira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13017643#comment-13017643 ] 

Flavio Junqueira commented on ZOOKEEPER-1001:
---------------------------------------------

One drawback I see with the solution in the first comment that you rederived is that the reader has to keep probing bookies for new entries, which generates unnecessary traffic when the application running on top is idle. It might not be a big deal in the case of the NN, but this is just to point out that with the LC hint, we can't benefit from notifications (through ZK watches).

When we close a ledger, we write the last committed entry to a closed znode, and that znode also establishes that the writer is done with the ledger. We don't change the LC hint on bookies once we close a ledger. 

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf, zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (ZOOKEEPER-1001) Read from open ledger

Posted by "Flavio Junqueira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13011983#comment-13011983 ] 

Flavio Junqueira commented on ZOOKEEPER-1001:
---------------------------------------------

Rob, I agree with handling writer failures separately. What I'm trying to understand, and this is how I interpret the discussion so far, is if we should provide some functionality in the BK client to write periodically to ZooKeeper ranges of entry identifiers that have been committed or if we should leave to the application on top of BK to do it (if the app needs it, of course).

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf, zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (ZOOKEEPER-1001) Read from open ledger

Posted by "Robert Chansler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13012192#comment-13012192 ] 

Robert Chansler commented on ZOOKEEPER-1001:
--------------------------------------------

Flavio, for the HDFS journal, there is no need for elaborate connections with ZooKeeper. A feature that would be convenient for readers, is an indication whether a returned record is committed. (All records of a closed ledger are committed; record N of an open ledger is committed only if exists record M where M.LC is greater or equal to N.) Otherwise a reader must buffer an arbitrary number of records, or else be in close agreement with the writer that the number of uncommitted records is bounded. (OK for HDFS, I'd think.) Read(N) has 4 return possibilities: Here is committed record N, here is record N but it's not yet committed, there is no record N in the open ledger, N is beyond the end of the closed ledger.

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf, zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (ZOOKEEPER-1001) Read from open ledger

Posted by "Flavio Junqueira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12998468#comment-12998468 ] 

Flavio Junqueira commented on ZOOKEEPER-1001:
---------------------------------------------

Ben and I discussed this issue offline, and I'd like to summarize our discussion. 

To enable readers to read from a ledger open for writing we need to have a couple of things in place:

# An openLedger call that does not try to recover the ledger if it can't find the corresponding ledger znode on zookeeper;
# A notification mechanism to let the reader know how far it can read into a ledger and when. 

For the first point, we can add a new call to the api for unsafely opening a ledger. This call is unsafe in the sense that the end of the ledger is not known and the client needs to figure out what entries have been committed so that it can safely read them. 

This last point brings us to the discussion of how to notify the reader that new entries have been committed (we don't want a reader either waiting too long to read new entries or trying to guess when new entries have come in). 
We see it possibly implemented in one of two ways: inside or outside bookkeeper. Implementing it inside bookkeeper is not trivial, since our replication protocol does not require bookies to talk to each other and no bookie individually knows when an entry has been committed. The second option seems to be more feasible. The writer can communicate periodically to one or more readers the entries that have been committed either directly or through zookeeper.

One alternative for a reader to learn what entries have been committed is to read the last hint from bookies. We have a mechanism implemented that enables a reader to determine what was the last entry confirmed at the time the last entry of a ledger was generated. This approach, however, has the drawback that the hint is behind the last committed entry, since an entry can only have a previous entry as a hint.   

Thoughts or questions?
   

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ZOOKEEPER-1001) Read from open ledger

Posted by "Robert Chansler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13011434#comment-13011434 ] 

Robert Chansler commented on ZOOKEEPER-1001:
--------------------------------------------

Trying too hard? For the HDFS application, and a big cluster, a reader that reaches the end of the ledger can sleep for a second, and then confidently expect to find hundreds of additional records. 
Whether and/or how to fault the writing process should be a separate issue. (See Ben's comment from 28 February.)

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf, zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (ZOOKEEPER-1001) Read from open ledger

Posted by "Flavio Junqueira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009211#comment-13009211 ] 

Flavio Junqueira commented on ZOOKEEPER-1001:
---------------------------------------------

Ivan, the problem is that if you have no information on what entries have been committed, the application process might end up reading one entry that has only been partially written. For safety, the application has to implement a mechanism to guarantee that it will only read committed entries, a la TeaKeeper. The open call, however, is not aware of what the application is doing, so it doesn't know if the application is really reading only committed entries, and in that sense the open operation is unsafe. 

Do you agree now or it is still unclear for you? 

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf, zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (ZOOKEEPER-1001) Read from open ledger

Posted by "dhruba borthakur (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13012843#comment-13012843 ] 

dhruba borthakur commented on ZOOKEEPER-1001:
---------------------------------------------

> to do it through the BK client is to have the writer periodically writing to the CLOSED znode the last committed entry, 

+1

> incorporate such accesses to ZooKeeper to the BK client

+1 

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf, zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Updated: (ZOOKEEPER-1001) Read from open ledger

Posted by "Flavio Junqueira (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Flavio Junqueira updated ZOOKEEPER-1001:
----------------------------------------

    Attachment: zk-1001-design-doc.pdf

Adding a preliminary design doc. Comments are welcome as usual.

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (ZOOKEEPER-1001) Read from open ledger

Posted by "Flavio Junqueira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009208#comment-13009208 ] 

Flavio Junqueira commented on ZOOKEEPER-1001:
---------------------------------------------

Dhruba, I have updated the document to include a figure that illustrates the interaction I was trying to describe. Could you please have a look and let me know if it is clear for you and if you agree?

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf, zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (ZOOKEEPER-1001) Read from open ledger

Posted by "Flavio Junqueira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13015314#comment-13015314 ] 

Flavio Junqueira commented on ZOOKEEPER-1001:
---------------------------------------------

@Rob
{quote}
Can a client reading an open ledger from bookie B ever be confident that it will see committed record N short of the ledger being closed? If the answer is No, then it seems that even if an oracle tells me that N is committed, then my reading client must survey a quorum of bookies to be certain of finding record N. 
{quote}

An oracle tells you that entry up to N has been committed (written to a quorum), so the client knows that if it reads up to N, the it is safe. To find any given entry, we follow the same order scheme as the writer does (for efficiency), so the client does not have to scan all bookies to find an entry, so your observation about reading from a quorum is correct. However, it is important to note that quorums in BookKeeper are not necessarily majorities. 

{quote}
And a survey of a quorum of bookies would also find the record that commits N, obviating the need for any oracle. If the answer is Yes, the reading client will see record N without the complexity of consulting the oracle if only the reader is a little patient.
{quote}

This is not correct. The fact that a client finds a copy of an entry in one bookie does necessarily mean that the entry has been committed. Not finding it in a quorum also does not mean that it hasn't been committed, since one bookie might be unavailable at the time of the query.

There has to be agreement somewhere in the system about the committed entries, and so far we have done it through zookeeper when a ledger closes.

{quote}
Anyway, for HDFS, why not just start a new ledger every minute, and have the standby server only read from closed ledgers? (Sixty seconds of latency.)
{quote}

I don't see any important problem with this solution, aside from the overhead of creating many ledgers over time. 

@dhruba
{quote}
is the writing of a ledger entry atomic (for a single bookie)? For example, if an application writes a ledger entry to a certain bookie and a concurrent reader tries to read that entry (even if that entry is not committed to all bookies), is it possible that only a part of that ledger entry is visible to the reader?
{quote}

The interface to a bookie is simple: if you ask for an entry of a given ledger and the entry exists, then the bookie will return. That's main reason why we need to make sure that the reader only requests committed entries.


> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf, zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (ZOOKEEPER-1001) Read from open ledger

Posted by "Flavio Junqueira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12999446#comment-12999446 ] 

Flavio Junqueira commented on ZOOKEEPER-1001:
---------------------------------------------

Based on the previous discussion, I'd like to propose that for now we expose a call that allows clients to open a ledger for reading unsafely in the sense that I explained above. Any objection or word of support? Dhruba?

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ZOOKEEPER-1001) Read from open ledger

Posted by "Flavio Junqueira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13010170#comment-13010170 ] 

Flavio Junqueira commented on ZOOKEEPER-1001:
---------------------------------------------

Hi guys, Thanks for the comments.

Utkarsh, I'm not sure I understand why you say "ZK access done server side". If we have access to ZK for open ledgers, I feel that it should be on the client, either through the application directly or through the BK client.

Dhruba, what you suggest sounds like the proposal I posted yesterday. Could you please check it again?

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf, zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (ZOOKEEPER-1001) Read from open ledger

Posted by "Flavio Junqueira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12998546#comment-12998546 ] 

Flavio Junqueira commented on ZOOKEEPER-1001:
---------------------------------------------

The problem of reading uncommitted entries is that the uncommitted entries may never be committed, and it may lead to inconsistencies in the system. Say that the writer writes entry n+1 to a single bookie and crashes before it is able to commit it. A concurrent reader may end up reading n+1, and a later client that recovers the ledger may end up reading up to n only. This might lead to inconsistencies in some use cases, perhaps not yours.

At the same time, your description sort of supports our preference for notifying outside bookkeeper. If your use case does not require it, then you may choose not to implement it.



  

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ZOOKEEPER-1001) Read from open ledger

Posted by "Flavio Junqueira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13012416#comment-13012416 ] 

Flavio Junqueira commented on ZOOKEEPER-1001:
---------------------------------------------

I also agree that it is not strictly necessary for the HDFS journal to have the NN connecting to ZooKeeper, since the information of what entries have been committed can be conveyed in other ways, e.g., by explicitly sending from the writer to the reader(s). Bookies can't provide the hints you're referring to because no single bookie has a global view of a ledger. Consequently, I can only see those hints working either via ZooKeeper or via direct communication.

Since we use a ZooKeeper instance to manage a bookie pool and the BK client talks to ZooKeeper today, the discussion so far seems to converge to using ZooKeeper to pass the information on what entries are committed. One idea we have suggested in this jira to do it through the BK client is to have the writer periodically writing to the CLOSED znode the last committed entry, and having the reader(s) reading this value. The mechanism to write the CLOSED znode is there already, so there is a small amount of code change needed. We need essentially to introduce a call to the BK api that forces the BK client to write the CLOSED znode.

Given that some applications, including the NN, might learn of committed entries through ZooKeeper, it seems to make sense to incorporate such accesses to ZooKeeper to the BK client, but I don't think we have reached agreement on it yet and leaving to the application to implement it when needed is still an option. If we do it in the way I suggest, then an application would not be forced to use ZooKeeper for such hints, and direct communication would also be possible. 

Also, If we end up going this direction of periodically writing to the CLOSED znode, we should change the name of the znode to something else, since it doesn't really represent any longer what the znode does.

 

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf, zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (ZOOKEEPER-1001) Read from open ledger

Posted by "Utkarsh Srivastava (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13010529#comment-13010529 ] 

Utkarsh Srivastava commented on ZOOKEEPER-1001:
-----------------------------------------------

Ideally, all ZK access would be done by the bookie, so that the client is as thin as possible. This scheme has certain nice properties like easy upgrades, changes to layout etc. as mentioned by Dhruba. But it's also a radical departure from the current BK design.

I agree that accessing ZK through the BK client api is the only sane option right now.

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf, zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (ZOOKEEPER-1001) Read from open ledger

Posted by "Flavio Junqueira (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Flavio Junqueira updated ZOOKEEPER-1001:
----------------------------------------

    Attachment: zk-1001-design-doc.pdf

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf, zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (ZOOKEEPER-1001) Read from open ledger

Posted by "Benjamin Reed (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13000400#comment-13000400 ] 

Benjamin Reed commented on ZOOKEEPER-1001:
------------------------------------------

the time to get the rest of the ledgers will be dominated by the time to detect the failure of the writer. for most applications you will already have something in place for failure detection. for example, in the case of the namenode, you will have a backup watching for the primary to die. when that happens, the backup will simply reopen the ledger and allow recovery to take place and read the last few entries. since it only needs to read the ones that were committed during recovery, this will happen very fast. 

> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (ZOOKEEPER-1001) Read from open ledger

Posted by "Ivan Kelly (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009158#comment-13009158 ] 

Ivan Kelly commented on ZOOKEEPER-1001:
---------------------------------------

Is "Unsafe" a good name for this? Once you've written the last committed id, the operation is the same as reading from a ledger which had been closed at that last committed id. Isn't this safe?


> Read from open ledger
> ---------------------
>
>                 Key: ZOOKEEPER-1001
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1001
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: contrib-bookkeeper
>            Reporter: Flavio Junqueira
>         Attachments: zk-1001-design-doc.pdf
>
>
> The BookKeeper client currently does not allow a client to read from an open ledger. That is, if the creator of a ledger is still writing to it (and the ledger is not closed), then an attempt to open the same ledger for reading will execute the code to recover the ledger, assuming that the ledger has not been correctly closed.
> It seems that there are applications that do require the ability to read from a ledger while it is being written to, and the main goal of this jira is to discuss possible implementations of this feature.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira