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

Sijie Guo commented on BOOKKEEPER-463:
--------------------------------------

{quote}
Sure, but this case is particularly critical because not throwing an exception 
could end up deleting all your ledgers accidentally.
{quote}

for the concern about a bad implementation end up deleting all ledgers. I think 
we need to make the documentation of this interface more clearly. I refactor 
the interface comments as below:

{code}
+    /**
+     * Interface of the ledger meta range iterator from
+     * storage (e.g. in ZooKeeper or other key/value store)
+     */
+    interface LedgerRangeIterator {
+
+        /**
+         * @return true if there are entries existed in ledger metadata store. 
false only when there
+         * are indeed no entries in ledger metadata store.
+         * @throws IOException when there is any problem accessing ledger 
metadata store. you should
+         * not just return false and silence the problem fail to access ledger 
metadata store. otherwise
+         * it would end up deleting all ledgers by accident.
+         */
+        public boolean hasNext() throws IOException;
+
+        /**
+         * Get the next element.
+         *
+         * @return the next element.
+         * @throws IOException when there is any problem accessing ledger 
metadata store. you should
+         * not just return false and silence the problem fail to access ledger 
metadata store. otherwise
+         * it would end up deleting all ledgers by accident.
+         */
+        public LedgerRange next() throws IOException;
+    }
{code}
                
> Refactor garbage collection code for ease to plugin different GC algorithm.
> ---------------------------------------------------------------------------
>
>                 Key: BOOKKEEPER-463
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-463
>             Project: Bookkeeper
>          Issue Type: Sub-task
>          Components: bookkeeper-server
>            Reporter: Sijie Guo
>            Assignee: Fangmin Lv
>             Fix For: 4.2.0
>
>         Attachments: 
> 0001-BOOKKEEPER-463-Refactor-garbage-collection-code-for-.patch, 
> BOOKKEEPER-463.patch, BOOKKEEPER-463.patch, BOOKKEEPER-463.patch, 
> BOOKKEEPER-463.patch, BOOKKEEPER-463.patch, BOOKKEEPER-463.patch, 
> BOOKKEEPER-463.patch, BOOKKEEPER-463.patch, BOOKKEEPER-463.patch
>
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to