You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bookkeeper.apache.org by "Sijie Guo (Created) (JIRA)" <ji...@apache.org> on 2011/10/14 11:28:11 UTC

[jira] [Created] (BOOKKEEPER-82) support journal rolling

support journal rolling
-----------------------

                 Key: BOOKKEEPER-82
                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-82
             Project: Bookkeeper
          Issue Type: Improvement
          Components: bookkeeper-server
    Affects Versions: 3.4.0
            Reporter: Sijie Guo
            Assignee: Sijie Guo


now bookkeeper is writing a single journal file, so the journal file has no chance to be garbage collected and the disk space keeps growing.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-82) support journal rolling

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

Flavio Junqueira commented on BOOKKEEPER-82:
--------------------------------------------

I haven't been able to determine if it is due to this patch, but I got the following error when running LedgerDeleteTest:

{noformat}
-------------------------------------------------------------------------------
Test set: org.apache.bookkeeper.test.LedgerDeleteTest
-------------------------------------------------------------------------------
Tests run: 4, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 24.779 sec <<< FAILURE!
testLedgerDeleteWithExistingEntryLogs[1](org.apache.bookkeeper.test.LedgerDeleteTest)  Time elapsed: 3.296 sec  <<< ERROR!
java.io.IOException: Short read for entryLog 1@85400(384!=1064)
	at org.apache.bookkeeper.bookie.EntryLogger.extractLedgersFromEntryLogs(EntryLogger.java:461)
	at org.apache.bookkeeper.bookie.EntryLogger.createLogId(EntryLogger.java:258)
	at org.apache.bookkeeper.bookie.EntryLogger.<init>(EntryLogger.java:112)
	at org.apache.bookkeeper.bookie.Bookie.<init>(Bookie.java:199)
	at org.apache.bookkeeper.proto.BookieServer.<init>(BookieServer.java:49)
	at org.apache.bookkeeper.test.LedgerDeleteTest.testLedgerDeleteWithExistingEntryLogs(LedgerDeleteTest.java:136)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:24)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
	at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:172)
	at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:78)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:70)

{noformat}
                
> support journal rolling
> -----------------------
>
>                 Key: BOOKKEEPER-82
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-82
>             Project: Bookkeeper
>          Issue Type: Improvement
>          Components: bookkeeper-server
>    Affects Versions: 4.0.0
>            Reporter: Sijie Guo
>            Assignee: Sijie Guo
>             Fix For: 4.0.0
>
>         Attachments: BOOKKEEPER-82.patch_v3, BOOKKEEPER-82.patch_v4, bookkeeper-82.patch, bookkeeper-82.patch_v2
>
>
> now bookkeeper is writing a single journal file, so the journal file has no chance to be garbage collected and the disk space keeps growing.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-82) support journal rolling

Posted by "Sijie Guo (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BOOKKEEPER-82?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13130385#comment-13130385 ] 

Sijie Guo commented on BOOKKEEPER-82:
-------------------------------------

Thanks, Flavio. It is ok to put it on the review board. And I will try to add test cases for this.
                
> support journal rolling
> -----------------------
>
>                 Key: BOOKKEEPER-82
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-82
>             Project: Bookkeeper
>          Issue Type: Improvement
>          Components: bookkeeper-server
>    Affects Versions: 3.4.0
>            Reporter: Sijie Guo
>            Assignee: Sijie Guo
>         Attachments: bookkeeper-82.patch
>
>
> now bookkeeper is writing a single journal file, so the journal file has no chance to be garbage collected and the disk space keeps growing.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-82) support journal rolling

Posted by "Hudson (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BOOKKEEPER-82?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13148420#comment-13148420 ] 

Hudson commented on BOOKKEEPER-82:
----------------------------------

Integrated in bookkeeper-trunk #211 (See [https://builds.apache.org/job/bookkeeper-trunk/211/])
    BOOKKEEPER-82: support journal rolling (Sijie Guo via fpj)

fpj : 
Files : 
* /zookeeper/bookkeeper/trunk/CHANGES.txt
* /zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java
* /zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java
* /zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/BookieJournalRollingTest.java
* /zookeeper/bookkeeper/trunk/doc/bookkeeperConfig.textile

                
> support journal rolling
> -----------------------
>
>                 Key: BOOKKEEPER-82
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-82
>             Project: Bookkeeper
>          Issue Type: Improvement
>          Components: bookkeeper-server
>    Affects Versions: 4.0.0
>            Reporter: Sijie Guo
>            Assignee: Sijie Guo
>             Fix For: 4.0.0
>
>         Attachments: BOOKKEEPER-82.patch_v3, BOOKKEEPER-82.patch_v4, BOOKKEEPER-82.patch_v5, bookkeeper-82.patch, bookkeeper-82.patch_v2, bookkeeper-server.log
>
>
> now bookkeeper is writing a single journal file, so the journal file has no chance to be garbage collected and the disk space keeps growing.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-82) support journal rolling

Posted by "Sijie Guo (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BOOKKEEPER-82?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13148239#comment-13148239 ] 

Sijie Guo commented on BOOKKEEPER-82:
-------------------------------------

ah, this failure is introduced in my code.

I added SyncThread#interrupt during bookie shutdown to interrupt SyncThread#wait(flush_interval).

{code:title=Bookie.java}
public synchronized void shutdown() throws InterruptedException {
    if (!running) { // avoid shutdown twice
        return;
    }
    // Shutdown the ZK client
    if(zk != null) zk.close();
    this.interrupt();
    this.join();
    syncThread.running = false;
    // sync thread may in wait status
    syncThread.interrupt();
    syncThread.join();
    for(LedgerDescriptor d: ledgers.values()) {
        d.close();
    }
    // Shutdown the EntryLogger which has the GarbageCollector Thread running
    entryLogger.shutdown();
    // setting running to false here, so watch thread in bookie server know it only after bookie shut down
    running = false;
}
{code}

If a thread is blocked in an I/O operation upon an interruptible channel then the channel will be closed, the thread's interrupt status will be set, and it will receive a ClosedByInterruptException.

So if SyncThread is running flushing ledger index / entry loggers, it will cause ClosedByInterruptException. 

Since sync thread may be blocked in #wait or I/O operations, I suggested that interrupts SyncThread when it doesn't do flushing as below: 

{code:title=SyncThread}

        // flag to ensure sync thread will not be interrupted during flush
        final AtomicBoolean flushing = new AtomicBoolean(false);

        public void run() {
            while(running) {
                synchronized(this) {
                    try {
                        wait(flushInterval);
                        if (!entryLogger.testAndClearSomethingWritten()) {
                            continue;
                        }
                    } catch (InterruptedException e) {
                        Thread.currentThread().interrupt();
                        continue;
                    }
                }

                // try to mark flushing flag to make sure it would not be interrupted
                // by shutdown during flushing. otherwise it will receive
                // ClosedByInterruptException which may cause index file & entry logger
                // closed and corrupted.
                if (!flushing.compareAndSet(false, true)) {
                    // set flushing flag failed, means flushing is true now
                    // indicates another thread wants to interrupt sync thread to exit
                    break;
                }

                // ... doing flush ...
            }
        }

        void shutdown() {
            running = false;
            if (flushing.compareAndSet(false, true)) {
                // if setting flushing flag succeed, means syncThread is not flushing now
                // it is safe to interrupt itself now 
                this.interrupt();
            }
            this.join();
        }

{code} 

                
> support journal rolling
> -----------------------
>
>                 Key: BOOKKEEPER-82
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-82
>             Project: Bookkeeper
>          Issue Type: Improvement
>          Components: bookkeeper-server
>    Affects Versions: 4.0.0
>            Reporter: Sijie Guo
>            Assignee: Sijie Guo
>             Fix For: 4.0.0
>
>         Attachments: BOOKKEEPER-82.patch_v3, BOOKKEEPER-82.patch_v4, bookkeeper-82.patch, bookkeeper-82.patch_v2, bookkeeper-server.log
>
>
> now bookkeeper is writing a single journal file, so the journal file has no chance to be garbage collected and the disk space keeps growing.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-82) support journal rolling

Posted by "Sijie Guo (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BOOKKEEPER-82?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13147692#comment-13147692 ] 

Sijie Guo commented on BOOKKEEPER-82:
-------------------------------------

the exception indicates that entry logger file is corrupted. 

I have added code in EntryLogger#shutdown to ensure buffered data is flushed.

{code:title=EntryLogger.java}
    /**
     * Shutdown method to gracefully stop all threads spawned in this class and exit.
     *
     * @throws InterruptedException if there is an exception stopping threads.
     */
    public void shutdown() throws InterruptedException {
        gcThread.running = false;
        gcThread.interrupt();
        gcThread.join();
        // since logChannel is buffered channel, do flush when shutting down
        try {
            flush();
        } catch (IOException ie) {
            // we have no idea how to avoid io exception during shutting down, so just ignore it
            LOG.fatal("Error flush entry log during shutting down, which may cause entry log corrupted.", ie);
        }
    }
{code}

So the entry logger file should not be corrupted, otherwise it was interrupted before flush or io exception occurred during flush.

Could you turn test debug level on to INFO or WARN level, and rerun the test to grap more information? since I can't reproduce this issue either running LedgerDeleteTest alone or running all test cases . :( 
                
> support journal rolling
> -----------------------
>
>                 Key: BOOKKEEPER-82
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-82
>             Project: Bookkeeper
>          Issue Type: Improvement
>          Components: bookkeeper-server
>    Affects Versions: 4.0.0
>            Reporter: Sijie Guo
>            Assignee: Sijie Guo
>             Fix For: 4.0.0
>
>         Attachments: BOOKKEEPER-82.patch_v3, BOOKKEEPER-82.patch_v4, bookkeeper-82.patch, bookkeeper-82.patch_v2
>
>
> now bookkeeper is writing a single journal file, so the journal file has no chance to be garbage collected and the disk space keeps growing.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-82) support journal rolling

Posted by "jiraposter@reviews.apache.org (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BOOKKEEPER-82?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13147553#comment-13147553 ] 

jiraposter@reviews.apache.org commented on BOOKKEEPER-82:
---------------------------------------------------------



bq.  On 2011-11-09 17:48:34, fpj wrote:
bq.  > Good job, Sijie. I only have a few minor comments. One important general comment I have is that we need documentation for this feature. Ideally we commit a patch for BOOKKEEPER-82 that includes doc changes. Otherwise, I'd like to have a blocker jira to make sure that we don't have a release without the doc changes.

I would add doc for this feature.


bq.  On 2011-11-09 17:48:34, fpj wrote:
bq.  > http://svn.apache.org/repos/asf/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java, line 592
bq.  > <https://reviews.apache.org/r/2745/diff/1/?file=56625#file56625line592>
bq.  >
bq.  >     I think we can remove this todo, right?

Yes.


bq.  On 2011-11-09 17:48:34, fpj wrote:
bq.  > http://svn.apache.org/repos/asf/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java, line 598
bq.  > <https://reviews.apache.org/r/2745/diff/1/?file=56625#file56625line598>
bq.  >
bq.  >     Typo on journal.

I will fix it.


bq.  On 2011-11-09 17:48:34, fpj wrote:
bq.  > http://svn.apache.org/repos/asf/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java, line 460
bq.  > <https://reviews.apache.org/r/2745/diff/1/?file=56626#file56626line460>
bq.  >
bq.  >     If there are corrupted entries, it is true that we can fetch copies from other bookies, but I don't think we have a mechanism for doing it yet, so it sounds safer to keep throwing an exception here for now, no?


I changed throwing an exception to skipping it, because I found bookie servers can't be started due to entry logger corruption after restartBookieServers in test cases.
This corruption is because that entry logger uses a BufferedChannel but it doesn't do flush when shutting down. So we read partial entry after those servers are restarted.

I will add code in EntryLogger#shutdown to ensure buffered data persisted to disk, so it can pass unit tests.

Since corruption is a complex issue, I agreed keeping throwing an exception here for now.

I created a jira BOOKKEEPER-62 before. Maybe we can handle data corruption in that jira.


- Sijie


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/2745/#review3130
-----------------------------------------------------------


On 2011-11-07 17:46:11, Sijie Guo wrote:
bq.  
bq.  -----------------------------------------------------------
bq.  This is an automatically generated e-mail. To reply, visit:
bq.  https://reviews.apache.org/r/2745/
bq.  -----------------------------------------------------------
bq.  
bq.  (Updated 2011-11-07 17:46:11)
bq.  
bq.  
bq.  Review request for bookkeeper.
bq.  
bq.  
bq.  Summary
bq.  -------
bq.  
bq.  implement journal rolling
bq.  
bq.  1) remove journals whose id are less than marked journal id. since they journals' data and index has been persisted to disk.
bq.  2) replay entires started from marked position in marked journal to speed up bookie start up.
bq.  
bq.  
bq.  This addresses bug BOOKKEEPER-82.
bq.      http://issues.apache.org/jira/browse/BOOKKEEPER-82
bq.  
bq.  
bq.  Diffs
bq.  -----
bq.  
bq.    http://svn.apache.org/repos/asf/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java 1198776 
bq.    http://svn.apache.org/repos/asf/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java 1198776 
bq.    http://svn.apache.org/repos/asf/zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/BookieJournalRollingTest.java PRE-CREATION 
bq.  
bq.  Diff: https://reviews.apache.org/r/2745/diff
bq.  
bq.  
bq.  Testing
bq.  -------
bq.  
bq.  
bq.  Thanks,
bq.  
bq.  Sijie
bq.  
bq.


                
> support journal rolling
> -----------------------
>
>                 Key: BOOKKEEPER-82
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-82
>             Project: Bookkeeper
>          Issue Type: Improvement
>          Components: bookkeeper-server
>    Affects Versions: 4.0.0
>            Reporter: Sijie Guo
>            Assignee: Sijie Guo
>             Fix For: 4.0.0
>
>         Attachments: bookkeeper-82.patch, bookkeeper-82.patch_v2
>
>
> now bookkeeper is writing a single journal file, so the journal file has no chance to be garbage collected and the disk space keeps growing.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (BOOKKEEPER-82) support journal rolling

Posted by "Sijie Guo (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BOOKKEEPER-82?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sijie Guo updated BOOKKEEPER-82:
--------------------------------

    Attachment: BOOKKEEPER-82.patch_v5

add code as commented to avoid interrupting sync thread during flushing.
                
> support journal rolling
> -----------------------
>
>                 Key: BOOKKEEPER-82
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-82
>             Project: Bookkeeper
>          Issue Type: Improvement
>          Components: bookkeeper-server
>    Affects Versions: 4.0.0
>            Reporter: Sijie Guo
>            Assignee: Sijie Guo
>             Fix For: 4.0.0
>
>         Attachments: BOOKKEEPER-82.patch_v3, BOOKKEEPER-82.patch_v4, BOOKKEEPER-82.patch_v5, bookkeeper-82.patch, bookkeeper-82.patch_v2, bookkeeper-server.log
>
>
> now bookkeeper is writing a single journal file, so the journal file has no chance to be garbage collected and the disk space keeps growing.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-82) support journal rolling

Posted by "jiraposter@reviews.apache.org (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BOOKKEEPER-82?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13145641#comment-13145641 ] 

jiraposter@reviews.apache.org commented on BOOKKEEPER-82:
---------------------------------------------------------


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/2745/
-----------------------------------------------------------

Review request for bookkeeper.


Summary
-------

implement journal rolling

1) remove journals whose id are less than marked journal id. since they journals' data and index has been persisted to disk.
2) replay entires started from marked position in marked journal to speed up bookie start up.


This addresses bug BOOKKEEPER-82.
    http://issues.apache.org/jira/browse/BOOKKEEPER-82


Diffs
-----

  http://svn.apache.org/repos/asf/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java 1198776 
  http://svn.apache.org/repos/asf/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java 1198776 
  http://svn.apache.org/repos/asf/zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/BookieJournalRollingTest.java PRE-CREATION 

Diff: https://reviews.apache.org/r/2745/diff


Testing
-------


Thanks,

Sijie


                
> support journal rolling
> -----------------------
>
>                 Key: BOOKKEEPER-82
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-82
>             Project: Bookkeeper
>          Issue Type: Improvement
>          Components: bookkeeper-server
>    Affects Versions: 3.4.0
>            Reporter: Sijie Guo
>            Assignee: Sijie Guo
>             Fix For: 4.0.0
>
>         Attachments: bookkeeper-82.patch, bookkeeper-82.patch_v2
>
>
> now bookkeeper is writing a single journal file, so the journal file has no chance to be garbage collected and the disk space keeps growing.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-82) support journal rolling

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

Flavio Junqueira commented on BOOKKEEPER-82:
--------------------------------------------

Sijie, I'll review more carefully and give you comments. In the meanwhile, would you mind putting your patch on the review board and perhaps writing a test for this feature?
                
> support journal rolling
> -----------------------
>
>                 Key: BOOKKEEPER-82
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-82
>             Project: Bookkeeper
>          Issue Type: Improvement
>          Components: bookkeeper-server
>    Affects Versions: 3.4.0
>            Reporter: Sijie Guo
>            Assignee: Sijie Guo
>         Attachments: bookkeeper-82.patch
>
>
> now bookkeeper is writing a single journal file, so the journal file has no chance to be garbage collected and the disk space keeps growing.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-82) support journal rolling

Posted by "jiraposter@reviews.apache.org (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BOOKKEEPER-82?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13147187#comment-13147187 ] 

jiraposter@reviews.apache.org commented on BOOKKEEPER-82:
---------------------------------------------------------


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/2745/#review3130
-----------------------------------------------------------


Good job, Sijie. I only have a few minor comments. One important general comment I have is that we need documentation for this feature. Ideally we commit a patch for BOOKKEEPER-82 that includes doc changes. Otherwise, I'd like to have a blocker jira to make sure that we don't have a release without the doc changes.


http://svn.apache.org/repos/asf/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java
<https://reviews.apache.org/r/2745/#comment6943>

    I think we can remove this todo, right?



http://svn.apache.org/repos/asf/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java
<https://reviews.apache.org/r/2745/#comment6941>

    Typo on journal.



http://svn.apache.org/repos/asf/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java
<https://reviews.apache.org/r/2745/#comment6942>

    If there are corrupted entries, it is true that we can fetch copies from other bookies, but I don't think we have a mechanism for doing it yet, so it sounds safer to keep throwing an exception here for now, no?


- fpj


On 2011-11-07 17:46:11, Sijie Guo wrote:
bq.  
bq.  -----------------------------------------------------------
bq.  This is an automatically generated e-mail. To reply, visit:
bq.  https://reviews.apache.org/r/2745/
bq.  -----------------------------------------------------------
bq.  
bq.  (Updated 2011-11-07 17:46:11)
bq.  
bq.  
bq.  Review request for bookkeeper.
bq.  
bq.  
bq.  Summary
bq.  -------
bq.  
bq.  implement journal rolling
bq.  
bq.  1) remove journals whose id are less than marked journal id. since they journals' data and index has been persisted to disk.
bq.  2) replay entires started from marked position in marked journal to speed up bookie start up.
bq.  
bq.  
bq.  This addresses bug BOOKKEEPER-82.
bq.      http://issues.apache.org/jira/browse/BOOKKEEPER-82
bq.  
bq.  
bq.  Diffs
bq.  -----
bq.  
bq.    http://svn.apache.org/repos/asf/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java 1198776 
bq.    http://svn.apache.org/repos/asf/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java 1198776 
bq.    http://svn.apache.org/repos/asf/zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/BookieJournalRollingTest.java PRE-CREATION 
bq.  
bq.  Diff: https://reviews.apache.org/r/2745/diff
bq.  
bq.  
bq.  Testing
bq.  -------
bq.  
bq.  
bq.  Thanks,
bq.  
bq.  Sijie
bq.  
bq.


                
> support journal rolling
> -----------------------
>
>                 Key: BOOKKEEPER-82
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-82
>             Project: Bookkeeper
>          Issue Type: Improvement
>          Components: bookkeeper-server
>    Affects Versions: 4.0.0
>            Reporter: Sijie Guo
>            Assignee: Sijie Guo
>             Fix For: 4.0.0
>
>         Attachments: bookkeeper-82.patch, bookkeeper-82.patch_v2
>
>
> now bookkeeper is writing a single journal file, so the journal file has no chance to be garbage collected and the disk space keeps growing.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (BOOKKEEPER-82) support journal rolling

Posted by "Sijie Guo (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BOOKKEEPER-82?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sijie Guo updated BOOKKEEPER-82:
--------------------------------

    Attachment: BOOKKEEPER-82.patch_v4

add textile doc in new patch.
                
> support journal rolling
> -----------------------
>
>                 Key: BOOKKEEPER-82
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-82
>             Project: Bookkeeper
>          Issue Type: Improvement
>          Components: bookkeeper-server
>    Affects Versions: 4.0.0
>            Reporter: Sijie Guo
>            Assignee: Sijie Guo
>             Fix For: 4.0.0
>
>         Attachments: BOOKKEEPER-82.patch_v3, BOOKKEEPER-82.patch_v4, bookkeeper-82.patch, bookkeeper-82.patch_v2
>
>
> now bookkeeper is writing a single journal file, so the journal file has no chance to be garbage collected and the disk space keeps growing.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-82) support journal rolling

Posted by "jiraposter@reviews.apache.org (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BOOKKEEPER-82?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13147615#comment-13147615 ] 

jiraposter@reviews.apache.org commented on BOOKKEEPER-82:
---------------------------------------------------------



bq.  On 2011-11-09 17:48:34, fpj wrote:
bq.  > Good job, Sijie. I only have a few minor comments. One important general comment I have is that we need documentation for this feature. Ideally we commit a patch for BOOKKEEPER-82 that includes doc changes. Otherwise, I'd like to have a blocker jira to make sure that we don't have a release without the doc changes.
bq.  
bq.  Sijie Guo wrote:
bq.      I would add doc for this feature.

Sijie, java docs are good, but I meant to say textile documentation. Check the "doc" folder.


- fpj


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/2745/#review3130
-----------------------------------------------------------


On 2011-11-10 08:39:27, Sijie Guo wrote:
bq.  
bq.  -----------------------------------------------------------
bq.  This is an automatically generated e-mail. To reply, visit:
bq.  https://reviews.apache.org/r/2745/
bq.  -----------------------------------------------------------
bq.  
bq.  (Updated 2011-11-10 08:39:27)
bq.  
bq.  
bq.  Review request for bookkeeper.
bq.  
bq.  
bq.  Summary
bq.  -------
bq.  
bq.  implement journal rolling
bq.  
bq.  1) remove journals whose id are less than marked journal id. since they journals' data and index has been persisted to disk.
bq.  2) replay entires started from marked position in marked journal to speed up bookie start up.
bq.  
bq.  
bq.  This addresses bug BOOKKEEPER-82.
bq.      http://issues.apache.org/jira/browse/BOOKKEEPER-82
bq.  
bq.  
bq.  Diffs
bq.  -----
bq.  
bq.    http://svn.apache.org/repos/asf/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java 1200193 
bq.    http://svn.apache.org/repos/asf/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java 1200193 
bq.    http://svn.apache.org/repos/asf/zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/BookieJournalRollingTest.java PRE-CREATION 
bq.  
bq.  Diff: https://reviews.apache.org/r/2745/diff
bq.  
bq.  
bq.  Testing
bq.  -------
bq.  
bq.  
bq.  Thanks,
bq.  
bq.  Sijie
bq.  
bq.


                
> support journal rolling
> -----------------------
>
>                 Key: BOOKKEEPER-82
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-82
>             Project: Bookkeeper
>          Issue Type: Improvement
>          Components: bookkeeper-server
>    Affects Versions: 4.0.0
>            Reporter: Sijie Guo
>            Assignee: Sijie Guo
>             Fix For: 4.0.0
>
>         Attachments: BOOKKEEPER-82.patch_v3, bookkeeper-82.patch, bookkeeper-82.patch_v2
>
>
> now bookkeeper is writing a single journal file, so the journal file has no chance to be garbage collected and the disk space keeps growing.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (BOOKKEEPER-82) support journal rolling

Posted by "jiraposter@reviews.apache.org (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BOOKKEEPER-82?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13147555#comment-13147555 ] 

jiraposter@reviews.apache.org commented on BOOKKEEPER-82:
---------------------------------------------------------


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/2745/
-----------------------------------------------------------

(Updated 2011-11-10 08:39:27.750726)


Review request for bookkeeper.


Changes
-------

add document for this feature.
fix typos.
ensure entry logger flush its buffered data during EntryLogger#shutdown.


Summary
-------

implement journal rolling

1) remove journals whose id are less than marked journal id. since they journals' data and index has been persisted to disk.
2) replay entires started from marked position in marked journal to speed up bookie start up.


This addresses bug BOOKKEEPER-82.
    http://issues.apache.org/jira/browse/BOOKKEEPER-82


Diffs (updated)
-----

  http://svn.apache.org/repos/asf/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java 1200193 
  http://svn.apache.org/repos/asf/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java 1200193 
  http://svn.apache.org/repos/asf/zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/BookieJournalRollingTest.java PRE-CREATION 

Diff: https://reviews.apache.org/r/2745/diff


Testing
-------


Thanks,

Sijie


                
> support journal rolling
> -----------------------
>
>                 Key: BOOKKEEPER-82
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-82
>             Project: Bookkeeper
>          Issue Type: Improvement
>          Components: bookkeeper-server
>    Affects Versions: 4.0.0
>            Reporter: Sijie Guo
>            Assignee: Sijie Guo
>             Fix For: 4.0.0
>
>         Attachments: BOOKKEEPER-82.patch_v3, bookkeeper-82.patch, bookkeeper-82.patch_v2
>
>
> now bookkeeper is writing a single journal file, so the journal file has no chance to be garbage collected and the disk space keeps growing.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (BOOKKEEPER-82) support journal rolling

Posted by "Sijie Guo (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BOOKKEEPER-82?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sijie Guo updated BOOKKEEPER-82:
--------------------------------

    Attachment: BOOKKEEPER-82.patch_v3
    
> support journal rolling
> -----------------------
>
>                 Key: BOOKKEEPER-82
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-82
>             Project: Bookkeeper
>          Issue Type: Improvement
>          Components: bookkeeper-server
>    Affects Versions: 4.0.0
>            Reporter: Sijie Guo
>            Assignee: Sijie Guo
>             Fix For: 4.0.0
>
>         Attachments: BOOKKEEPER-82.patch_v3, bookkeeper-82.patch, bookkeeper-82.patch_v2
>
>
> now bookkeeper is writing a single journal file, so the journal file has no chance to be garbage collected and the disk space keeps growing.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (BOOKKEEPER-82) support journal rolling

Posted by "Sijie Guo (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BOOKKEEPER-82?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sijie Guo updated BOOKKEEPER-82:
--------------------------------

    Fix Version/s: 4.0.0
    
> support journal rolling
> -----------------------
>
>                 Key: BOOKKEEPER-82
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-82
>             Project: Bookkeeper
>          Issue Type: Improvement
>          Components: bookkeeper-server
>    Affects Versions: 3.4.0
>            Reporter: Sijie Guo
>            Assignee: Sijie Guo
>             Fix For: 4.0.0
>
>         Attachments: bookkeeper-82.patch
>
>
> now bookkeeper is writing a single journal file, so the journal file has no chance to be garbage collected and the disk space keeps growing.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (BOOKKEEPER-82) support journal rolling

Posted by "Sijie Guo (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BOOKKEEPER-82?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sijie Guo updated BOOKKEEPER-82:
--------------------------------

    Attachment: bookkeeper-82.patch_v2

attach new patch to support journal rolling
                
> support journal rolling
> -----------------------
>
>                 Key: BOOKKEEPER-82
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-82
>             Project: Bookkeeper
>          Issue Type: Improvement
>          Components: bookkeeper-server
>    Affects Versions: 3.4.0
>            Reporter: Sijie Guo
>            Assignee: Sijie Guo
>             Fix For: 4.0.0
>
>         Attachments: bookkeeper-82.patch, bookkeeper-82.patch_v2
>
>
> now bookkeeper is writing a single journal file, so the journal file has no chance to be garbage collected and the disk space keeps growing.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (BOOKKEEPER-82) support journal rolling

Posted by "Sijie Guo (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BOOKKEEPER-82?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sijie Guo updated BOOKKEEPER-82:
--------------------------------

    Attachment: bookkeeper-82.patch

attach a patch to support rolling journals

1) LogMark should use marked lastMark to safely ensure the entries before lastMark are all persisted.

2) relaying journal can start from last marked log, which can speed up bookie startup

3) bookie.getHandle needs to check whether the ledger existed in current node, not just checking the memory.
                
> support journal rolling
> -----------------------
>
>                 Key: BOOKKEEPER-82
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-82
>             Project: Bookkeeper
>          Issue Type: Improvement
>          Components: bookkeeper-server
>    Affects Versions: 3.4.0
>            Reporter: Sijie Guo
>            Assignee: Sijie Guo
>         Attachments: bookkeeper-82.patch
>
>
> now bookkeeper is writing a single journal file, so the journal file has no chance to be garbage collected and the disk space keeps growing.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (BOOKKEEPER-82) support journal rolling

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

Flavio Junqueira updated BOOKKEEPER-82:
---------------------------------------

    Attachment: bookkeeper-server.log

Adding logs for a run that failed. Notice the log entries at:

# 2011-11-10 17:10:01,059
# 2011-11-10 17:10:01,060
 
                
> support journal rolling
> -----------------------
>
>                 Key: BOOKKEEPER-82
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-82
>             Project: Bookkeeper
>          Issue Type: Improvement
>          Components: bookkeeper-server
>    Affects Versions: 4.0.0
>            Reporter: Sijie Guo
>            Assignee: Sijie Guo
>             Fix For: 4.0.0
>
>         Attachments: BOOKKEEPER-82.patch_v3, BOOKKEEPER-82.patch_v4, bookkeeper-82.patch, bookkeeper-82.patch_v2, bookkeeper-server.log
>
>
> now bookkeeper is writing a single journal file, so the journal file has no chance to be garbage collected and the disk space keeps growing.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira