Remove preinitializeOnForeignThread

This commit is contained in:
Andrew Noyes 2021-06-23 14:33:41 -07:00
parent 7f35a66383
commit d69fda1d2e
4 changed files with 4 additions and 10 deletions

View File

@ -27,7 +27,6 @@
ISingleThreadTransaction* ISingleThreadTransaction::allocateOnForeignThread(Type type) { ISingleThreadTransaction* ISingleThreadTransaction::allocateOnForeignThread(Type type) {
if (type == Type::RYW) { if (type == Type::RYW) {
auto tr = new ReadYourWritesTransaction; auto tr = new ReadYourWritesTransaction;
tr->preinitializeOnForeignThread();
return tr; return tr;
} else if (type == Type::SIMPLE_CONFIG) { } else if (type == Type::SIMPLE_CONFIG) {
auto tr = new SimpleConfigTransaction; auto tr = new SimpleConfigTransaction;
@ -43,12 +42,15 @@ ISingleThreadTransaction* ISingleThreadTransaction::allocateOnForeignThread(Type
void ISingleThreadTransaction::create(ISingleThreadTransaction* tr, Type type, Database db) { void ISingleThreadTransaction::create(ISingleThreadTransaction* tr, Type type, Database db) {
switch (type) { switch (type) {
case Type::RYW: case Type::RYW:
dynamic_cast<ReadYourWritesTransaction*>(tr)->~ReadYourWritesTransaction();
new (tr) ReadYourWritesTransaction(db); new (tr) ReadYourWritesTransaction(db);
break; break;
case Type::SIMPLE_CONFIG: case Type::SIMPLE_CONFIG:
dynamic_cast<SimpleConfigTransaction*>(tr)->~SimpleConfigTransaction();
new (tr) SimpleConfigTransaction(db); new (tr) SimpleConfigTransaction(db);
break; break;
case Type::PAXOS_CONFIG: case Type::PAXOS_CONFIG:
dynamic_cast<PaxosConfigTransaction*>(tr)->~PaxosConfigTransaction();
new (tr) PaxosConfigTransaction(db); new (tr) PaxosConfigTransaction(db);
break; break;
default: default:

View File

@ -241,8 +241,6 @@ public:
explicit Transaction(Database const& cx); explicit Transaction(Database const& cx);
~Transaction(); ~Transaction();
void preinitializeOnForeignThread() { committedVersion = invalidVersion; }
void setVersion(Version v); void setVersion(Version v);
Future<Version> getReadVersion() { return getReadVersion(0); } Future<Version> getReadVersion() { return getReadVersion(0); }
Future<Version> getRawReadVersion(); Future<Version> getRawReadVersion();
@ -418,7 +416,7 @@ private:
Database cx; Database cx;
double backoff; double backoff;
Version committedVersion; Version committedVersion{ invalidVersion };
CommitTransactionRequest tr; CommitTransactionRequest tr;
Future<Version> readVersion; Future<Version> readVersion;
Promise<Optional<Value>> metadataVersion; Promise<Optional<Value>> metadataVersion;

View File

@ -1729,10 +1729,6 @@ void ReadYourWritesTransaction::getWriteConflicts(KeyRangeMap<bool>* result) {
} }
} }
void ReadYourWritesTransaction::preinitializeOnForeignThread() {
tr.preinitializeOnForeignThread();
}
void ReadYourWritesTransaction::setTransactionID(uint64_t id) { void ReadYourWritesTransaction::setTransactionID(uint64_t id) {
tr.setTransactionID(id); tr.setTransactionID(id);
} }

View File

@ -153,8 +153,6 @@ public:
void getWriteConflicts(KeyRangeMap<bool>* result) override; void getWriteConflicts(KeyRangeMap<bool>* result) override;
void preinitializeOnForeignThread();
Database getDatabase() const { return tr.getDatabase(); } Database getDatabase() const { return tr.getDatabase(); }
const TransactionInfo& getTransactionInfo() const { return tr.info; } const TransactionInfo& getTransactionInfo() const { return tr.info; }