Skip to content

Commit d47b649

Browse files
committed
Revert "Warm reboot: Add support for bool Select::hasCachedSelectable() (sonic-net#214)"
This reverts commit c5d5434.
1 parent f94c170 commit d47b649

3 files changed

Lines changed: 1 addition & 96 deletions

File tree

common/select.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,5 @@ int Select::select(Selectable **c, int timeout)
162162

163163
}
164164

165-
bool Select::isQueueEmpty()
166-
{
167-
return m_ready.empty();
168-
}
169-
170165
};
171166

common/select.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Select
3333
};
3434

3535
int select(Selectable **c, int timeout = -1);
36-
bool isQueueEmpty();
36+
3737
private:
3838
struct cmp
3939
{

tests/redis_subscriber_state_ut.cpp

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ using namespace swss;
2121
static const string dbhost = "localhost";
2222
static const int dbport = 6379;
2323
static const string testTableName = "UT_REDIS_TABLE";
24-
static const string testTableName2 = "UT_REDIS_TABLE2";
2524

2625
static inline int getMaxFields(int i)
2726
{
@@ -431,92 +430,3 @@ TEST(SubscriberStateTable, one_producer_multiple_subscriber)
431430
}
432431
cout << endl << "Done." << endl;
433432
}
434-
435-
TEST(SubscriberStateTable, cachedData)
436-
{
437-
clearDB();
438-
439-
/* Prepare init data */
440-
int index = 0;
441-
int maxNumOfFields = 2;
442-
443-
DBConnector db(TEST_DB, dbhost, dbport, 0);
444-
Table p(&db, testTableName);
445-
string key1 = "TheKey1";
446-
/* Set operation */
447-
{
448-
vector<FieldValueTuple> fields;
449-
for (int j = 0; j < maxNumOfFields; j++)
450-
{
451-
FieldValueTuple t(field(index, j), value(index, j));
452-
fields.push_back(t);
453-
}
454-
p.set(key1, fields);
455-
}
456-
457-
Table p2(&db, testTableName2);
458-
string key2 = "TheKey2";
459-
/* Set operation */
460-
{
461-
vector<FieldValueTuple> fields;
462-
for (int j = 0; j < maxNumOfFields; j++)
463-
{
464-
FieldValueTuple t(field(index, j), value(index, j));
465-
fields.push_back(t);
466-
}
467-
p2.set(key2, fields);
468-
}
469-
470-
/* Prepare subscriber */
471-
SubscriberStateTable c1(&db, testTableName);
472-
SubscriberStateTable c2(&db, testTableName2);
473-
Select cs;
474-
Selectable *selectcs;
475-
cs.addSelectable(&c1);
476-
cs.addSelectable(&c2);
477-
478-
/* Pop operation and check CachedSelectable */
479-
{
480-
string key = key1;
481-
int ret = cs.select(&selectcs);
482-
EXPECT_EQ(ret, Select::OBJECT);
483-
KeyOpFieldsValuesTuple kco;
484-
if (selectcs == &c1)
485-
{
486-
c1.pop(kco);
487-
}
488-
else
489-
{
490-
c2.pop(kco);
491-
key = key2;
492-
}
493-
494-
EXPECT_EQ(kfvKey(kco), key);
495-
EXPECT_EQ(kfvOp(kco), "SET");
496-
497-
/* There is one cached selectable left */
498-
bool r = cs.isQueueEmpty();
499-
EXPECT_FALSE(r);
500-
501-
ret = cs.select(&selectcs);
502-
EXPECT_EQ(ret, Select::OBJECT);
503-
if (key == key1)
504-
{
505-
EXPECT_TRUE(selectcs == &c2);
506-
key = key2;
507-
c2.pop(kco);
508-
}
509-
else
510-
{
511-
EXPECT_TRUE(selectcs == &c1);
512-
key = key1;
513-
c1.pop(kco);
514-
}
515-
516-
EXPECT_EQ(kfvKey(kco), key);
517-
EXPECT_EQ(kfvOp(kco), "SET");
518-
/* No cached selectable left */
519-
r = cs.isQueueEmpty();
520-
EXPECT_TRUE(r);
521-
}
522-
}

0 commit comments

Comments
 (0)