Open lomoval opened 3 years ago
Some additions.
I think the problem is not the intense load itself, but the transaction timeout and processing of the results.
failed auto read tx, Neo4jError: Neo.ClientError.Transaction.TransactionTimedOut (...)
result.Next
), you will get automatic tx reading failed, no primary nodes to return, gogm: no data found
and GOGM wraps non found error with transaction error. Example (try to get nodes with enough timeout and too small):
func EmbedType() {
// In NEO
// match (a:KnowledgePage) where a.name contains 'e' return count(a)
//
// count(a)
// 27
conf := gogm.Config{
Host: "127.0.0.1",
Port: 7687,
Username: "neo4j",
Password: "neo4j",
PoolSize: 50,
IndexStrategy: gogm.IGNORE_INDEX,
LoadStrategy: gogm.SCHEMA_LOAD_STRATEGY,
DefaultTransactionTimeout: time.Millisecond,
}
confLongTimeout := conf
confLongTimeout.DefaultTransactionTimeout = 5000 * time.Millisecond
checkTimeout(conf)
checkTimeout(confLongTimeout)
return
}
func checkTimeout(conf gogm.Config) {
g, err := gogm.New(&conf, gogm.DefaultPrimaryKeyStrategy, &model.KnowledgePage{})
if err != nil {
log.Err(err).Msg("")
return
}
s, err := g.NewSessionV2(gogm.SessionConfig{AccessMode: gogm.AccessModeRead})
if err != nil {
log.Err(err).Msg("")
return
}
var pages []*model.KnowledgePage
err = s.LoadAllDepthFilter(context.Background(), &pages, 0, cypherdsl.C(&cypherdsl.ConditionConfig{
ConditionOperator: cypherdsl.ContainsOperator,
Name: "n",
Field: "name",
Check: "e",
}), nil)
if err != nil {
log.Err(err).Msg("")
return
}
log.Debug().Msgf("Nodes count: %d", len(pages))
return
}
Output:
...
{"level":"error","error":"failed auto read tx, no primary nodes to return, gogm: data not found","time":"2024-06-05T18:35:48+03:00"}
...
{"level":"debug","time":"2024-06-05T18:35:54+03:00","message":"Nodes count: 27"}
Hello. I got a strange situation with GOGM and intense loading of objects. Sometimes GOGM returns "gogm: data not found" instead of loaded objects or timeout-error.
Here's some code example. It creates go-routines that loads objects and outputs the result (error or not).
And the output. Timeout errors are OK, but why does GOGM return
gogm: data not found
?