Skip to content

Conversation

@millgi
Copy link

@millgi millgi commented Apr 24, 2018

Hello,

I added a column on statements showing the transaction isolation. It helped us to investigate the reason of some dead locks in our programs.

@sylvainlaurent
Copy link
Owner

Hello,
please rebase on master, this commit is quite old...

@millgi millgi force-pushed the feature/add-transaction-isolation branch from 5cc1a99 to b5e131b Compare April 24, 2018 20:55
@millgi
Copy link
Author

millgi commented Apr 25, 2018

Hi Sylvain,

Done, I tested it successfully at work today.


public class LogRepositoryConstants {

public static final String TRANSACTION_ISOLATION_COLUMN = "TRANSACTION_ISOLATION";
Copy link
Owner

Choose a reason for hiding this comment

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

please keep the alphabetical sorting

final Integer transactionIsolation = (Integer) dataModel.getValueAt(modelRowIndex, columnModelIndex);
if (transactionIsolation != null ) {
switch (transactionIsolation) {
case 1:
Copy link
Owner

Choose a reason for hiding this comment

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

please use constants in java.sql.Connection instead of numeric values

switch (transactionIsolation) {
case 1:
component.setText("RU");
component.setToolTipText("Read Uncommitted");
Copy link
Owner

Choose a reason for hiding this comment

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

I suggest to add the constant number in parentheses so that if one wants to apply a filter the value to use will be easily visible.
e.g "Read Uncommitted (1)"


final StatementLog log = new StatementLog(connectionInfo.getUuid(), randomUUID(), System.currentTimeMillis(),
StatementType.BASE_NON_PREPARED_STMT, "myrawsql", Thread.currentThread().getName(), 123, true);
StatementType.BASE_NON_PREPARED_STMT, "myrawsql", Thread.currentThread().getName(), 123, true, 0);
Copy link
Owner

Choose a reason for hiding this comment

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

0 -> java.sql.Connection.TRANSACTION_NONE

final List<String> sqlList = Arrays.asList("st1", "st2", "st3");
final BatchedPreparedStatementsLog batchedLogs = new BatchedPreparedStatementsLog(log.getConnectionUuid(),
randomUUID(), System.currentTimeMillis(), "myRaw stmt", sqlList, "myThread", 13, true);
randomUUID(), System.currentTimeMillis(), "myRaw stmt", sqlList, "myThread", 13, true, 1);
Copy link
Owner

Choose a reason for hiding this comment

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

idem, 1 -> ...

@millgi millgi force-pushed the feature/add-transaction-isolation branch from b5e131b to c624958 Compare April 25, 2018 20:27
@millgi millgi force-pushed the feature/add-transaction-isolation branch from c624958 to 6277bd6 Compare May 29, 2018 15:40
@millgi
Copy link
Author

millgi commented May 29, 2018

Hello Sylvain, all small fixes pushed. Sorry for the response time, other stuff to do...

@sylvainlaurent sylvainlaurent merged commit 802cb2f into sylvainlaurent:master May 29, 2018
@sylvainlaurent
Copy link
Owner

sylvainlaurent commented May 29, 2018 via email

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.

2 participants