Skip to content

Commit

Permalink
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)

Currently the work_queue implementation already has a variable
max_queue_len_ in C++, but python does not have it. This variable
maintains the max_q_size reached so far. This is added as part of the
fix.
Partial-Bug: 1576798
Change-Id: Ifdde919aa9ad8c2b4f2600f8673af62123875fc2
  • Loading branch information
arvindvis committed May 27, 2016
1 parent fee634a commit ececa85
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,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
Original file line number Diff line number Diff line change
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 ececa85

Please sign in to comment.