From f768a4d3b46f7ac3bb9792ef2501f39749b5ba1e Mon Sep 17 00:00:00 2001 From: PINS Working Group Date: Mon, 1 Nov 2021 15:42:38 -0400 Subject: [PATCH] Removing Batch OPs pending further review signed-of-by:Don Newton --- common/producerstatetable.cpp | 94 ----------------------------------- common/producerstatetable.h | 9 ---- 2 files changed, 103 deletions(-) diff --git a/common/producerstatetable.cpp b/common/producerstatetable.cpp index d3b212c44..d7bf7d8e4 100644 --- a/common/producerstatetable.cpp +++ b/common/producerstatetable.cpp @@ -185,100 +185,6 @@ void ProducerStateTable::del(const string &key, const string &op /*= DEL_COMMAND } } -void ProducerStateTable::set(const std::vector& values) -{ - if (m_tempViewActive) - { - // Write to temp view instead of DB - for (const auto &value : values) - { - const std::string &key = kfvKey(value); - for (const auto &iv : kfvFieldsValues(value)) - { - m_tempViewState[key][fvField(iv)] = fvValue(iv); - } - } - return; - } - - // Assembly redis command args into a string vector - vector args; - args.emplace_back("EVALSHA"); - args.emplace_back(m_shaBatchedSet); - args.emplace_back(to_string(values.size() + 3)); - args.emplace_back(getChannelName()); - args.emplace_back(getKeySetName()); - args.emplace_back(getStateHashPrefix() + getTableName() + getTableNameSeparator()); - for (const auto &value : values) - { - args.emplace_back(kfvKey(value)); - } - args.emplace_back("G"); - for (const auto &value : values) - { - args.emplace_back(to_string(kfvFieldsValues(value).size())); - for (const auto &iv : kfvFieldsValues(value)) - { - args.emplace_back(fvField(iv)); - args.emplace_back(fvValue(iv)); - } - } - - // Transform data structure - vector args1; - transform(args.begin(), args.end(), back_inserter(args1), [](const string &s) { return s.c_str(); } ); - - // Invoke redis command - RedisCommand command; - command.formatArgv((int)args1.size(), &args1[0], NULL); - m_pipe->push(command, REDIS_REPLY_NIL); - if (!m_buffered) - { - m_pipe->flush(); - } -} - -void ProducerStateTable::del(const std::vector& keys) -{ - if (m_tempViewActive) - { - // Write to temp view instead of DB - for (const auto &key : keys) - { - m_tempViewState.erase(key); - } - return; - } - - // Assembly redis command args into a string vector - vector args; - args.emplace_back("EVALSHA"); - args.emplace_back(m_shaBatchedDel); - args.emplace_back(to_string(keys.size() + 4)); - args.emplace_back(getChannelName()); - args.emplace_back(getKeySetName()); - args.emplace_back(getDelKeySetName()); - args.emplace_back(getStateHashPrefix() + getTableName() + getTableNameSeparator()); - for (const auto &key : keys) - { - args.emplace_back(key); - } - args.emplace_back("G"); - - // Transform data structure - vector args1; - transform(args.begin(), args.end(), back_inserter(args1), [](const string &s) { return s.c_str(); } ); - - // Invoke redis command - RedisCommand command; - command.formatArgv((int)args1.size(), &args1[0], NULL); - m_pipe->push(command, REDIS_REPLY_NIL); - if (!m_buffered) - { - m_pipe->flush(); - } -} - void ProducerStateTable::flush() { m_pipe->flush(); diff --git a/common/producerstatetable.h b/common/producerstatetable.h index 995595023..0e871bbf5 100644 --- a/common/producerstatetable.h +++ b/common/producerstatetable.h @@ -36,15 +36,6 @@ class ProducerStateTable : public TableBase, public TableName_KeySet %} #endif - // Batched version of set() and del(). - // The batched methods don't include (or use) op and prefix. They are - // written for specific use case only. The consumer logic (or batch size) - // might need to change if the producer does batched operations. - - // In set(), the op is ignored. - void set(const std::vector& values); - - void del(const std::vector& keys); void flush();