Update ISingleThreadTransaction::create to support PAXOS_CONFIG transactions

This commit is contained in:
sfc-gh-tclinkenbeard 2021-05-17 13:15:40 -07:00
parent ba8d21e340
commit da2f773759
3 changed files with 10 additions and 0 deletions

View File

@ -18,6 +18,8 @@
* limitations under the License. * limitations under the License.
*/ */
#pragma once
#include <memory> #include <memory>
#include "fdbclient/ConfigKnobs.h" #include "fdbclient/ConfigKnobs.h"

View File

@ -20,6 +20,7 @@
#include "fdbclient/DatabaseContext.h" #include "fdbclient/DatabaseContext.h"
#include "fdbclient/ISingleThreadTransaction.h" #include "fdbclient/ISingleThreadTransaction.h"
#include "fdbclient/PaxosConfigTransaction.h"
#include "fdbclient/ReadYourWrites.h" #include "fdbclient/ReadYourWrites.h"
#include "fdbclient/SimpleConfigTransaction.h" #include "fdbclient/SimpleConfigTransaction.h"
@ -32,6 +33,9 @@ ISingleThreadTransaction* ISingleThreadTransaction::allocateOnForeignThread(Type
} else if (type == Type::SIMPLE_CONFIG) { } else if (type == Type::SIMPLE_CONFIG) {
auto tr = (SimpleConfigTransaction*)(SimpleConfigTransaction::operator new(sizeof(SimpleConfigTransaction))); auto tr = (SimpleConfigTransaction*)(SimpleConfigTransaction::operator new(sizeof(SimpleConfigTransaction)));
return tr; return tr;
} else if (type == Type::PAXOS_CONFIG) {
auto tr = (PaxosConfigTransaction*)(PaxosConfigTransaction::operator new(sizeof(PaxosConfigTransaction)));
return tr;
} }
ASSERT(false); ASSERT(false);
return nullptr; return nullptr;
@ -45,6 +49,9 @@ void ISingleThreadTransaction::create(ISingleThreadTransaction* tr, Type type, D
case Type::SIMPLE_CONFIG: case Type::SIMPLE_CONFIG:
new (tr) SimpleConfigTransaction(db->getConnectionFile()->getConnectionString()); new (tr) SimpleConfigTransaction(db->getConnectionFile()->getConnectionString());
break; break;
case Type::PAXOS_CONFIG:
new (tr) PaxosConfigTransaction(db->getConnectionFile()->getConnectionString());
break;
default: default:
ASSERT(false); ASSERT(false);
} }

View File

@ -37,6 +37,7 @@ public:
enum class Type { enum class Type {
RYW, RYW,
SIMPLE_CONFIG, SIMPLE_CONFIG,
PAXOS_CONFIG,
}; };
static ISingleThreadTransaction* allocateOnForeignThread(Type type); static ISingleThreadTransaction* allocateOnForeignThread(Type type);