Skip to content

Commit

Permalink
Revert "[TableBase] Make channel name from both table name and databa…
Browse files Browse the repository at this point in the history
…se ID (sonic-net#568)"

This reverts commit bd4d0ce.
  • Loading branch information
qiluo-msft committed Jan 15, 2022
1 parent bd4d0ce commit 9e43ceb
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 18 deletions.
2 changes: 1 addition & 1 deletion common/consumerstatetable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ConsumerStateTable::ConsumerStateTable(DBConnector *db, const std::string &table
watch.checkStatusOK();
multi();
enqueue(std::string("SCARD ") + getKeySetName(), REDIS_REPLY_INTEGER);
subscribe(m_db, getChannelName(m_db->getDbId()));
subscribe(m_db, getChannelName());
bool succ = exec();
if (succ) break;
}
Expand Down
2 changes: 1 addition & 1 deletion common/consumertable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ConsumerTable::ConsumerTable(DBConnector *db, const string &tableName, int popBa
watch.checkStatusOK();
multi();
enqueue(string("LLEN ") + getKeyValueOpQueueTableName(), REDIS_REPLY_INTEGER);
subscribe(m_db, getChannelName(m_db->getDbId()));
subscribe(m_db, getChannelName());
enqueue(string("LLEN ") + getKeyValueOpQueueTableName(), REDIS_REPLY_INTEGER);
bool succ = exec();
if (succ) break;
Expand Down
6 changes: 3 additions & 3 deletions common/producerstatetable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void ProducerStateTable::set(const string &key, const vector<FieldValueTuple> &v
args.emplace_back("EVALSHA");
args.emplace_back(m_shaSet);
args.emplace_back(to_string(values.size() + 2));
args.emplace_back(getChannelName(m_pipe->getDbId()));
args.emplace_back(getChannelName());
args.emplace_back(getKeySetName());

args.insert(args.end(), values.size(), getStateHashPrefix() + getKeyName(key));
Expand Down Expand Up @@ -133,7 +133,7 @@ void ProducerStateTable::del(const string &key, const string &op /*= DEL_COMMAND
args.emplace_back("EVALSHA");
args.emplace_back(m_shaDel);
args.emplace_back("4");
args.emplace_back(getChannelName(m_pipe->getDbId()));
args.emplace_back(getChannelName());
args.emplace_back(getKeySetName());
args.emplace_back(getStateHashPrefix() + getKeyName(key));
args.emplace_back(getDelKeySetName());
Expand Down Expand Up @@ -307,7 +307,7 @@ void ProducerStateTable::apply_temp_view()
args.emplace_back("EVALSHA");
args.emplace_back(m_shaApplyView);
args.emplace_back(to_string(m_tempViewState.size() + 3));
args.emplace_back(getChannelName(m_pipe->getDbId()));
args.emplace_back(getChannelName());
args.emplace_back(getKeySetName());
args.emplace_back(getDelKeySetName());

Expand Down
2 changes: 1 addition & 1 deletion common/producertable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void ProducerTable::enqueueDbChange(const string &key, const string &value, cons
"EVALSHA %s 2 %s %s %s %s %s %s",
m_shaEnque.c_str(),
getKeyValueOpQueueTableName().c_str(),
getChannelName(m_pipe->getDbId()).c_str(),
getChannelName().c_str(),
key.c_str(),
value.c_str(),
op.c_str(),
Expand Down
12 changes: 0 additions & 12 deletions common/table.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,6 @@ class TableBase {
}

std::string getChannelName() { return m_tableName + "_CHANNEL"; }

/* Return tagged channel name */
std::string getChannelName(const std::string &tag)
{
return m_tableName + "_CHANNEL" + "@" + tag;
}

/* Return tagged channel name, most likely tag number could be dbId */
std::string getChannelName(int tag)
{
return getChannelName(std::to_string(tag));
}
private:
static const std::string TABLE_NAME_SEPARATOR_COLON;
static const std::string TABLE_NAME_SEPARATOR_VBAR;
Expand Down

0 comments on commit 9e43ceb

Please sign in to comment.