Skip to content

Commit

Permalink
CB-5458. Create GQL for log commits, implement logic
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisSinelnikov committed Aug 14, 2024
1 parent 9254684 commit 8a86808
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 0 deletions.
14 changes: 14 additions & 0 deletions server/bundles/io.cloudbeaver.server/schema/service.core.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,20 @@ type AsyncTaskInfo {
taskResult: Object
}

type TransactionLogInfos {
count: Int
transactionLogInfos: [ TransactionLogInfoItem ]
}

type TransactionLogInfoItem {
time: DateTime
type: String
queryString: String
durationMs: Int
rows: Int
result: String
}

# Various server errors descriptor

type ServerError {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,12 @@ extend type Mutation {
dataFormat: ResultDataFormat
): AsyncTaskInfo!

getTransactionLogInfo(
projectId: ID!,
connectionId: ID!,
contextId: ID!
): TransactionLogInfos

# Close results (free resources)
sqlResultClose(projectId: ID, connectionId: ID!, contextId: ID!, resultId: ID!): Boolean!

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.model.exec.DBCLogicalOperator;
import org.jkiss.dbeaver.model.exec.trace.DBCTraceProperty;
import org.jkiss.dbeaver.model.qm.QMTransactionLogInfo;
import org.jkiss.dbeaver.model.sql.registry.SQLGeneratorDescriptor;

import java.util.List;
Expand Down Expand Up @@ -202,4 +203,10 @@ WebAsyncTaskInfo asyncSqlRollbackTransaction(
WebAsyncTaskInfo asyncSqlCommitTransaction(
@NotNull WebSession webSession,
@NotNull WebSQLContextInfo sqlContext);

@WebAction

Check warning on line 207 in server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/DBWServiceSQL.java

View check run for this annotation

Jenkins-CI-integration / CheckStyle Java Report

server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/DBWServiceSQL.java#L207

Missing a Javadoc comment.
QMTransactionLogInfo getTransactionLogInfo(
@NotNull WebSession webSession,
@NotNull WebSQLContextInfo sqlContext
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.jkiss.dbeaver.model.exec.*;
import org.jkiss.dbeaver.model.exec.trace.DBCTrace;
import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.qm.QMTransactionLogInfo;
import org.jkiss.dbeaver.model.qm.QMTransactionState;
import org.jkiss.dbeaver.model.qm.QMUtils;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
Expand Down Expand Up @@ -216,6 +217,11 @@ public void run(DBRProgressMonitor monitor) throws InvocationTargetException, In

}

public QMTransactionLogInfo getTransactionLogInfo() {

Check warning on line 220 in server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/WebSQLContextInfo.java

View check run for this annotation

Jenkins-CI-integration / CheckStyle Java Report

server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/sql/WebSQLContextInfo.java#L220

Missing a Javadoc comment.
DBCExecutionContext context = processor.getExecutionContext();
return QMUtils.getTransactionLogInfo(context);
}

public WebAsyncTaskInfo commitTransaction() {
DBCExecutionContext context = processor.getExecutionContext();
DBCTransactionManager txnManager = DBUtils.getTransactionManager(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ public void bindWiring(DBWBindingContext model) throws DBWebException {
getService(env).asyncSqlRollbackTransaction(
getWebSession(env),
getSQLContext(env)
))
.dataFetcher("getTransactionLogInfo", env ->
getService(env).getTransactionLogInfo(
getWebSession(env),
getSQLContext(env)
));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.jkiss.dbeaver.model.exec.trace.DBCTraceProperty;
import org.jkiss.dbeaver.model.impl.sql.BasicSQLDialect;
import org.jkiss.dbeaver.model.navigator.DBNNode;
import org.jkiss.dbeaver.model.qm.QMTransactionLogInfo;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.sql.*;
import org.jkiss.dbeaver.model.sql.completion.SQLCompletionAnalyzer;
Expand Down Expand Up @@ -613,4 +614,9 @@ public WebAsyncTaskInfo asyncSqlCommitTransaction(@NotNull WebSession webSession
return contextInfo.commitTransaction();
}

@Override
public QMTransactionLogInfo getTransactionLogInfo(@NotNull WebSession webSession, @NotNull WebSQLContextInfo sqlContext) {
return sqlContext.getTransactionLogInfo();
}

}

0 comments on commit 8a86808

Please sign in to comment.