Revision 3df07d1703297cf8bf98327c1dc65f48d18957f5 authored by sdong on 19 May 2014, 17:40:18 UTC, committed by sdong on 19 May 2014, 18:52:12 UTC
Summary:
Add a feature to decrease the number of threads in thread pool.
Also instantly schedule more threads if number of threads is increased.

Here is the way it is implemented: each background thread needs its thread ID. After decreasing number of threads, all threads are woken up. The thread with the largest thread ID will terminate. If there are more threads to terminate, the thread will wake up all threads again.

Another change is made so that when number of threads is increased, more threads are created and all previous excessive threads are woken up to do the work.

Test Plan: Add a unit test.

Reviewers: haobo, dhruba

Reviewed By: haobo

CC: yhchiang, igor, nkg-, leveldb

Differential Revision: https://reviews.facebook.net/D18675
1 parent 1e56045
History
File Mode Size
builder.cc -rw-r--r-- 8.1 KB
builder.h -rw-r--r-- 1.8 KB
c.cc -rw-r--r-- 41.1 KB
c_test.c -rw-r--r-- 15.1 KB
column_family.cc -rw-r--r-- 19.1 KB
column_family.h -rw-r--r-- 15.3 KB
column_family_test.cc -rw-r--r-- 29.4 KB
compaction.cc -rw-r--r-- 7.7 KB
compaction.h -rw-r--r-- 5.5 KB
compaction_picker.cc -rw-r--r-- 32.5 KB
compaction_picker.h -rw-r--r-- 6.4 KB
corruption_test.cc -rw-r--r-- 12.3 KB
db_bench.cc -rw-r--r-- 88.1 KB
db_filesnapshot.cc -rw-r--r-- 4.9 KB
db_impl.cc -rw-r--r-- 159.8 KB
db_impl.h -rw-r--r-- 23.4 KB
db_impl_debug.cc -rw-r--r-- 4.1 KB
db_impl_readonly.cc -rw-r--r-- 4.9 KB
db_impl_readonly.h -rw-r--r-- 3.7 KB
db_iter.cc -rw-r--r-- 15.0 KB
db_iter.h -rw-r--r-- 991 bytes
db_stats_logger.cc -rw-r--r-- 2.6 KB
db_test.cc -rw-r--r-- 215.2 KB
dbformat.cc -rw-r--r-- 5.5 KB
dbformat.h -rw-r--r-- 11.2 KB
dbformat_test.cc -rw-r--r-- 4.0 KB
deletefile_test.cc -rw-r--r-- 9.0 KB
file_indexer.cc -rw-r--r-- 6.7 KB
file_indexer.h -rw-r--r-- 5.7 KB
file_indexer_test.cc -rw-r--r-- 9.2 KB
filename.cc -rw-r--r-- 7.7 KB
filename.h -rw-r--r-- 4.2 KB
filename_test.cc -rw-r--r-- 4.0 KB
internal_stats.cc -rw-r--r-- 15.6 KB
internal_stats.h -rw-r--r-- 6.4 KB
log_and_apply_bench.cc -rw-r--r-- 2.4 KB
log_format.h -rw-r--r-- 1.1 KB
log_reader.cc -rw-r--r-- 10.5 KB
log_reader.h -rw-r--r-- 4.4 KB
log_test.cc -rw-r--r-- 18.1 KB
log_writer.cc -rw-r--r-- 3.1 KB
log_writer.h -rw-r--r-- 1.6 KB
memtable.cc -rw-r--r-- 21.2 KB
memtable.h -rw-r--r-- 7.4 KB
memtable_list.cc -rw-r--r-- 8.9 KB
memtable_list.h -rw-r--r-- 4.9 KB
merge_context.h -rw-r--r-- 1.9 KB
merge_helper.cc -rw-r--r-- 8.2 KB
merge_helper.h -rw-r--r-- 4.2 KB
merge_operator.cc -rw-r--r-- 2.5 KB
merge_test.cc -rw-r--r-- 12.3 KB
perf_context_test.cc -rw-r--r-- 11.0 KB
plain_table_db_test.cc -rw-r--r-- 28.1 KB
prefix_test.cc -rw-r--r-- 15.6 KB
repair.cc -rw-r--r-- 12.6 KB
simple_table_db_test.cc -rw-r--r-- 22.4 KB
skiplist.h -rw-r--r-- 12.9 KB
skiplist_test.cc -rw-r--r-- 9.9 KB
snapshot.h -rw-r--r-- 2.3 KB
table_cache.cc -rw-r--r-- 6.6 KB
table_cache.h -rw-r--r-- 3.8 KB
table_properties_collector.cc -rw-r--r-- 2.2 KB
table_properties_collector.h -rw-r--r-- 2.9 KB
table_properties_collector_test.cc -rw-r--r-- 9.8 KB
tailing_iter.cc -rw-r--r-- 6.1 KB
tailing_iter.h -rw-r--r-- 2.9 KB
transaction_log_impl.cc -rw-r--r-- 8.7 KB
transaction_log_impl.h -rw-r--r-- 3.9 KB
version_edit.cc -rw-r--r-- 9.5 KB
version_edit.h -rw-r--r-- 5.2 KB
version_edit_test.cc -rw-r--r-- 1.9 KB
version_set.cc -rw-r--r-- 93.4 KB
version_set.h -rw-r--r-- 18.4 KB
version_set_test.cc -rw-r--r-- 5.6 KB
write_batch.cc -rw-r--r-- 16.4 KB
write_batch_internal.h -rw-r--r-- 4.3 KB
write_batch_test.cc -rw-r--r-- 9.7 KB

back to top