diff --git a/fdbclient/ISingleThreadTransaction.cpp b/fdbclient/ISingleThreadTransaction.cpp index 4a0b686540..a36f92fe9a 100644 --- a/fdbclient/ISingleThreadTransaction.cpp +++ b/fdbclient/ISingleThreadTransaction.cpp @@ -27,7 +27,6 @@ ISingleThreadTransaction* ISingleThreadTransaction::allocateOnForeignThread(Type type) { if (type == Type::RYW) { auto tr = new ReadYourWritesTransaction; - tr->preinitializeOnForeignThread(); return tr; } else if (type == Type::SIMPLE_CONFIG) { auto tr = new SimpleConfigTransaction; @@ -43,12 +42,15 @@ ISingleThreadTransaction* ISingleThreadTransaction::allocateOnForeignThread(Type void ISingleThreadTransaction::create(ISingleThreadTransaction* tr, Type type, Database db) { switch (type) { case Type::RYW: + dynamic_cast(tr)->~ReadYourWritesTransaction(); new (tr) ReadYourWritesTransaction(db); break; case Type::SIMPLE_CONFIG: + dynamic_cast(tr)->~SimpleConfigTransaction(); new (tr) SimpleConfigTransaction(db); break; case Type::PAXOS_CONFIG: + dynamic_cast(tr)->~PaxosConfigTransaction(); new (tr) PaxosConfigTransaction(db); break; default: diff --git a/fdbclient/NativeAPI.actor.h b/fdbclient/NativeAPI.actor.h index 043bcaf4f2..b0f589e97a 100644 --- a/fdbclient/NativeAPI.actor.h +++ b/fdbclient/NativeAPI.actor.h @@ -241,8 +241,6 @@ public: explicit Transaction(Database const& cx); ~Transaction(); - void preinitializeOnForeignThread() { committedVersion = invalidVersion; } - void setVersion(Version v); Future getReadVersion() { return getReadVersion(0); } Future getRawReadVersion(); @@ -418,7 +416,7 @@ private: Database cx; double backoff; - Version committedVersion; + Version committedVersion{ invalidVersion }; CommitTransactionRequest tr; Future readVersion; Promise> metadataVersion; diff --git a/fdbclient/ReadYourWrites.actor.cpp b/fdbclient/ReadYourWrites.actor.cpp index 4db07f527b..8b0ef80754 100644 --- a/fdbclient/ReadYourWrites.actor.cpp +++ b/fdbclient/ReadYourWrites.actor.cpp @@ -1729,10 +1729,6 @@ void ReadYourWritesTransaction::getWriteConflicts(KeyRangeMap* result) { } } -void ReadYourWritesTransaction::preinitializeOnForeignThread() { - tr.preinitializeOnForeignThread(); -} - void ReadYourWritesTransaction::setTransactionID(uint64_t id) { tr.setTransactionID(id); } diff --git a/fdbclient/ReadYourWrites.h b/fdbclient/ReadYourWrites.h index 65bb972da9..4f4827792d 100644 --- a/fdbclient/ReadYourWrites.h +++ b/fdbclient/ReadYourWrites.h @@ -153,8 +153,6 @@ public: void getWriteConflicts(KeyRangeMap* result) override; - void preinitializeOnForeignThread(); - Database getDatabase() const { return tr.getDatabase(); } const TransactionInfo& getTransactionInfo() const { return tr.info; }