The difference is that the Batch executor guarantees that sync will be
called before a task is marked done.

2011/10/8 hicks <zhux...@126.com>:
> hi,all:
>   i have a question about the option "commitlog_sync" in cassandra.yaml
> file.when its value is set to "batch",the ICommitLogExecutorService instance
> of CommitLog will be BatchCommitLogExecutorService in which there is a
> method named processWithSyncBatch.and in this method,there is a code
> segment:
>         while (!queue.isEmpty()
>                && queue.peek().getRawCallable() instanceof
> CommitLog.LogRecordAdder
>                && System.nanoTime() < end)
>         {
>             CheaterFutureTask task = queue.remove();
>             incompleteTasks.add(task);
>             taskValues.add(task.getRawCallable().call());
>         }
> task.getRawCallable().call() will call CommitLog.LogRecordAdder.run()
> which does the same thing as appendingThread in
> PeriodicCommitLogExecutorService. we can see the task in the queue is
> excecuted one by one,use logWriter to do the write operaton, finally do sync
> when the commitlog_sync_batch_window_in_ms is up or the queue has no
> task,just as PeriodicCommitLogExecutorService. i don't understand where
> reflect the conception of "batch"? or the question can be what is the
> difference between PeriodicCommitLogExecutorService and
> BatchCommitLogExecutorService?
>     Be expecting your response! Thks very much.
>
>



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com

Reply via email to