Skip to content

Fixed topic tests #534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/client/query/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -858,8 +858,8 @@ class TTransaction::TImpl : public std::enable_shared_from_this<TImpl> {

private:
bool ChangesAreAccepted = true; // haven't called Commit or Rollback yet
std::vector<TPrecommitTransactionCallback> PrecommitCallbacks;
std::vector<TOnFailureTransactionCallback> OnFailureCallbacks;
mutable std::vector<TPrecommitTransactionCallback> PrecommitCallbacks;
mutable std::vector<TOnFailureTransactionCallback> OnFailureCallbacks;

std::mutex PrecommitCallbacksMutex;
std::mutex OnFailureCallbacksMutex;
Expand Down
6 changes: 3 additions & 3 deletions src/client/topic/impl/read_session_impl.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -2183,6 +2183,9 @@ void TSingleClusterReadSessionImpl<UseMigrationProtocol>::TrySubscribeOnTransact
return;
}

txInfo->IsActive = true;
txInfo->Subscribed = true;

auto callback = [cbContext = this->SelfContext, txId, txInfo, consumer = Settings.ConsumerName_, client]() {
std::vector<TTopicOffsets> offsets;

Expand All @@ -2205,9 +2208,6 @@ void TSingleClusterReadSessionImpl<UseMigrationProtocol>::TrySubscribeOnTransact
};

tx.AddPrecommitCallback(std::move(callback));

txInfo->IsActive = true;
txInfo->Subscribed = true;
}
}

Expand Down
46 changes: 23 additions & 23 deletions src/client/topic/impl/write_session_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,34 +551,34 @@ void TWriteSessionImpl::TrySubscribeOnTransactionCommit(TTransactionBase* tx)
return;
}

txInfo->AllAcksReceived = NThreading::NewPromise<TStatus>();
txInfo->IsActive = true;
txInfo->Subscribed = true;
txInfo->AllAcksReceived = NThreading::NewPromise<TStatus>();
}

auto callback = [cbContext = this->SelfContext, txId, txInfo]() {
with_lock(txInfo->Lock) {
Y_ABORT_UNLESS(!txInfo->CommitCalled);

txInfo->CommitCalled = true;

if (txInfo->WriteCount == txInfo->AckCount) {
txInfo->AllAcksReceived.SetValue(MakeCommitTransactionSuccess());
if (auto self = cbContext->LockShared()) {
self->DeleteTx(txId);
auto callback = [cbContext = this->SelfContext, txId, txInfo]() {
with_lock(txInfo->Lock) {
Y_ABORT_UNLESS(!txInfo->CommitCalled);

txInfo->CommitCalled = true;

if (txInfo->WriteCount == txInfo->AckCount) {
txInfo->AllAcksReceived.SetValue(MakeCommitTransactionSuccess());
if (auto self = cbContext->LockShared()) {
self->DeleteTx(txId);
}
return txInfo->AllAcksReceived.GetFuture();
}

if (txInfo->IsActive) {
return txInfo->AllAcksReceived.GetFuture();
}
return txInfo->AllAcksReceived.GetFuture();
}

if (txInfo->IsActive) {
return txInfo->AllAcksReceived.GetFuture();
}
}

return NThreading::MakeFuture(MakeSessionExpiredError());
};

tx->AddPrecommitCallback(std::move(callback));

return NThreading::MakeFuture(MakeSessionExpiredError());
};

tx->AddPrecommitCallback(std::move(callback));
}
}

void TWriteSessionImpl::TrySignalAllAcksReceived(ui64 seqNo)
Expand Down
6 changes: 0 additions & 6 deletions tests/integration/topic/topic_to_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1335,9 +1335,6 @@ void TxUsage::TestWriteToTopic10()

void TxUsage::TestWriteToTopic26()
{
// TODO(brgayazov): fix test
GTEST_SKIP() << "Test is flaky";

//
// the test verifies a transaction in which data is read from a partition of one topic and written to
// another partition of this topic
Expand Down Expand Up @@ -1723,9 +1720,6 @@ TEST_F(TxUsageQuery, TEST_NAME(WriteToTopic_Demo_17))

void TxUsage::TestWriteToTopic25()
{
// TODO(brgayazov): fix test
GTEST_SKIP() << "Test is flaky";

//
// the test verifies a transaction in which data is read from one topic and written to another
//
Expand Down
Loading