Search in sources :

Example 1 with QuerySnapshot

use of org.neo4j.kernel.api.query.QuerySnapshot in project neo4j by neo4j.

the class QueryCollector method endSuccess.

@Override
public void endSuccess(ExecutingQuery query) {
    if (isCollecting) {
        QuerySnapshot snapshot = query.snapshot();
        var databaseId = query.databaseId().orElse(null);
        var queryText = snapshot.obfuscatedQueryText().orElse(null);
        var parameters = snapshot.obfuscatedQueryParameters().orElse(null);
        if (databaseId != null && queryText != null && parameters != null) {
            recentQueryBuffer.produce(new TruncatedQuerySnapshot(databaseId, queryText, snapshot.queryPlanSupplier(), parameters, snapshot.elapsedTimeMicros(), snapshot.compilationTimeMicros(), snapshot.startTimestampMillis(), maxQueryTextSize));
        }
    }
}
Also used : QuerySnapshot(org.neo4j.kernel.api.query.QuerySnapshot)

Example 2 with QuerySnapshot

use of org.neo4j.kernel.api.query.QuerySnapshot in project neo4j by neo4j.

the class TransactionDependenciesResolver method initDirectDependencies.

private Map<KernelTransactionHandle, Set<KernelTransactionHandle>> initDirectDependencies() {
    Map<KernelTransactionHandle, Set<KernelTransactionHandle>> directDependencies = new HashMap<>();
    Map<KernelTransactionHandle, List<ActiveLock>> transactionLocksMap = handleSnapshotsMap.keySet().stream().collect(toMap(identity(), getTransactionLocks()));
    for (Map.Entry<KernelTransactionHandle, Optional<QuerySnapshot>> entry : handleSnapshotsMap.entrySet()) {
        Optional<QuerySnapshot> snapshot = entry.getValue();
        if (snapshot.isPresent()) {
            KernelTransactionHandle txHandle = entry.getKey();
            evaluateDirectDependencies(directDependencies, transactionLocksMap, txHandle, snapshot.get());
        }
    }
    return directDependencies;
}
Also used : Set(java.util.Set) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) Optional(java.util.Optional) HashMap(java.util.HashMap) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) KernelTransactionHandle(org.neo4j.kernel.api.KernelTransactionHandle) HashMap(java.util.HashMap) Collectors.toMap(java.util.stream.Collectors.toMap) Map(java.util.Map) QuerySnapshot(org.neo4j.kernel.api.query.QuerySnapshot)

Aggregations

QuerySnapshot (org.neo4j.kernel.api.query.QuerySnapshot)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1 Collectors.toList (java.util.stream.Collectors.toList)1 Collectors.toMap (java.util.stream.Collectors.toMap)1 KernelTransactionHandle (org.neo4j.kernel.api.KernelTransactionHandle)1