Skip to content

Commit

Permalink
Merge "This fix provides a max_queue_length attribute for the sandesh…
Browse files Browse the repository at this point in the history
… queues on the send and recieve end A new sandesh field has been added to the following UVE to provide this information: SandeshModuleClientTrace (reports send sandesh sm max_queu_size) SandeshMessageStatsReq (reports send sandesh queue max_queue_size) ShowCollectorServerResp (reports collector sandesh SM max_queue_size)" into R3.0
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Jun 1, 2016
2 parents 233878a + ececa85 commit f401855
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/analytics/collector.cc
Expand Up @@ -480,6 +480,7 @@ void Collector::GetGeneratorSummaryInfo(vector<GeneratorSummaryInfo> *genlist) {
gsinfo.set_db_drop_level(db_drop_level);
}
}
gsinfo.set_max_sm_queue_count(gen->GetSandeshStateMachineMaxQueueCount());
genlist->push_back(gsinfo);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/analytics/collector_uve.sandesh
Expand Up @@ -112,6 +112,7 @@ struct GeneratorSummaryInfo {
7: optional u64 db_queue_count
8: optional string db_drop_level
9: optional bool sm_back_pressure
10: optional u64 max_sm_queue_count
}

/**
Expand Down
3 changes: 3 additions & 0 deletions src/analytics/generator.h
Expand Up @@ -91,6 +91,9 @@ class SandeshGenerator : public Generator {
void StartDbifReinit();
virtual DbHandler * GetDbHandler() const { return db_handler_.get(); }
bool UseGlobalDbHandler() const { return use_global_dbhandler_; }
uint32_t GetSandeshStateMachineMaxQueueCount() const {
return state_machine_->GetMaxQueueCount();
}

private:
virtual bool ProcessRules(const VizMsg *vmsg, bool rsc);
Expand Down
1 change: 1 addition & 0 deletions src/base/queue_task.h
Expand Up @@ -587,6 +587,7 @@ class WorkQueue {
}
AtomicDecrementQueueCount(&entry);
drops_++;
max_queue_len_ = count_;
return false;
}

Expand Down
20 changes: 19 additions & 1 deletion src/base/test/queue_task_test.cc
Expand Up @@ -208,7 +208,7 @@ class QueueTaskTest : public ::testing::Test {
tbb::atomic<bool> shutdown_test_exit_callback_sleep_;
};

TEST_F(QueueTaskTest, StartRunnerBasic) {
TEST_F(QueueTaskTest, StartRunnerBasic)
TaskScheduler *scheduler = TaskScheduler::GetInstance();
// Always do start runner
work_queue_.SetStartRunnerFunc(
Expand Down Expand Up @@ -244,6 +244,24 @@ TEST_F(QueueTaskTest, StartRunnerBasic) {
EXPECT_EQ(2, work_queue_.NumEnqueues());
EXPECT_EQ(1, work_queue_.NumDequeues());
EXPECT_EQ(1, work_queue_.Length());
// Verify WorkQueue max_queue_len_
EXPECT_EQ(1, work_queue_.max_queue_len());
work_queue_.Enqueue(enqueue_counter++);
work_queue_.Enqueue(enqueue_counter++);
work_queue_.Enqueue(enqueue_counter++);
task_util::WaitForIdle(1);
EXPECT_EQ(3, work_queue_.max_queue_len());
// Add test case for bounded workq
work_queue_.SetBounded(true);
work_queue_.size_(4);
work_queue_.Enqueue(enqueue_counter++);
work_queue_.Enqueue(enqueue_counter++);
work_queue_.Enqueue(enqueue_counter++);
work_queue_.Enqueue(enqueue_counter++);
EXPECT_EQ(4, work_queue_.max_queue_len());
work_queue_.Enqueue(enqueue_counter++);
EXPECT_EQ(4, work_queue_.max_queue_len());
task_util::WaitForIdle(1);
}

TEST_F(QueueTaskTest, StartRunnerInternals) {
Expand Down

0 comments on commit f401855

Please sign in to comment.