Skip to content

Conversation

@Cyrill
Copy link
Contributor

@Cyrill Cyrill commented Feb 15, 2024

/**
* Retrieves a collection of transaction UUIDs.
*
* @return a collection of transaction UUIDs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @return a collection of transaction UUIDs
* @return A collection of transaction UUIDs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 34 to 37
/**
* Keeps track of all closed RO transactions.
*/
public class ClosedTransactionTracker {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, it works only with RO transactions. Maybe rename it to ClosedReadOnlyTransactionTracker?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed

*/
public class ClosedTransactionTracker {

private static final int maxClosedTransactionsInBatch = 10_000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be upper case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 48 to 50
/**
* Topology service.
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/**
* Topology service.
*/
/** Topology service. */

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

UUID txId = TestTransactionIds.TRANSACTION_ID_GENERATOR.transactionIdFor(readTimestamp);

var tx = new ReadOnlyTransactionImpl(txManager, new HybridTimestampTracker(), txId, "localId", readTimestamp);
var tx = new ReadOnlyTransactionImpl(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about adding additional tests checking that RO transaction's cursors are closed after its finish?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a test to cover that

Comment on lines 63 to 65
private void processTxCleanup(CloseCursorsBatchMessage closeCursorsMessage) {
closeCursorsMessage.transactions().forEach(resourcesRegistry::close);
}
Copy link
Contributor

@denis-chudov denis-chudov Mar 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we can process potentially huge batch of transactions (tracker allows max size of 10k), I an not sure it's a good idea to do this in network thread. What do you think about doing this in cleanup thread within resource cleanup manager in background?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* Close transaction cursors message.
*/
@Transferable(TxMessageGroup.TX_CLOSE_CURSORS)
public interface CloseCursorsBatchMessage extends TimestampAware {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about FinishedTransactionsBatchMessage?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed

int cpus = Runtime.getRuntime().availableProcessors();

cleanupExecutor = new ThreadPoolExecutor(
writeIntentSwitchPool = new ThreadPoolExecutor(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It think it's worthy to rename as well

  • TxManagerImpl#executeCleanupAsync
  • IgniteThreadFactory.create(nodeName, "tx-async-cleanup", LOG, STORAGE_READ, STORAGE_WRITE) - thread name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed

@vldpyatkov vldpyatkov merged commit 7bb9ecf into apache:main Mar 5, 2024
@Cyrill Cyrill deleted the IGNITE-21291 branch March 5, 2024 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants