summaryrefslogtreecommitdiff
path: root/hdfs
diff options
context:
space:
mode:
authorHaobo Xu <haobo@fb.com>2013-09-12 00:53:30 -0700
committerHaobo Xu <haobo@fb.com>2013-09-12 16:15:36 -0700
commit1565dab8090fb2aba24027dde7f8daedf81f22a9 (patch)
tree90abbf8966735c1318aa75e1efa64a8c80e02986 /hdfs
parent0e422308aa2c2fd63be5a5d1f1458cb42054b096 (diff)
[RocksDB] Enhance Env to support two thread pools LOW and HIGH
Summary: this is the ground work for separating memtable flush jobs to their own thread pool. Both SetBackgroundThreads and Schedule take a third parameter Priority to indicate which thread pool they are working on. The names LOW and HIGH are just identifiers for two different thread pools, and does not indicate real difference in 'priority'. We can set number of threads in the pools independently. The thread pool implementation is refactored. Test Plan: make check Reviewers: dhruba, emayanke CC: leveldb Differential Revision: https://reviews.facebook.net/D12885
Diffstat (limited to 'hdfs')
-rw-r--r--hdfs/env_hdfs.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/hdfs/env_hdfs.h b/hdfs/env_hdfs.h
index bc286fe8d..b9309b3a1 100644
--- a/hdfs/env_hdfs.h
+++ b/hdfs/env_hdfs.h
@@ -107,8 +107,9 @@ class HdfsEnv : public Env {
virtual Status NewLogger(const std::string& fname, Logger** result);
- virtual void Schedule( void (*function)(void* arg), void* arg) {
- posixEnv->Schedule(function, arg);
+ virtual void Schedule(void (*function)(void* arg), void* arg,
+ Priority pri = LOW) {
+ posixEnv->Schedule(function, arg, pri);
}
virtual void StartThread(void (*function)(void* arg), void* arg) {
@@ -140,8 +141,8 @@ class HdfsEnv : public Env {
return posixEnv->GetAbsolutePath(db_path, output_path);
}
- virtual void SetBackgroundThreads(int number) {
- posixEnv->SetBackgroundThreads(number);
+ virtual void SetBackgroundThreads(int number, Priority pri = LOW) {
+ posixEnv->SetBackgroundThreads(number, pri);
}
virtual std::string TimeToString(uint64_t number) {
@@ -279,7 +280,8 @@ class HdfsEnv : public Env {
virtual Status NewLogger(const std::string& fname,
shared_ptr<Logger>* result){return notsup;}
- virtual void Schedule( void (*function)(void* arg), void* arg) {}
+ virtual void Schedule(void (*function)(void* arg), void* arg,
+ Priority pri = LOW) {}
virtual void StartThread(void (*function)(void* arg), void* arg) {}
@@ -296,7 +298,7 @@ class HdfsEnv : public Env {
virtual Status GetAbsolutePath(const std::string& db_path,
std::string* outputpath) {return notsup;}
- virtual void SetBackgroundThreads(int number) {}
+ virtual void SetBackgroundThreads(int number, Priority pri = LOW) {}
virtual std::string TimeToString(uint64_t number) { return "";}
};