authgear-server icon indicating copy to clipboard operation
authgear-server copied to clipboard

Elasticsearch reindex command cannot be run on HK cluster

Open louischan-oursky opened this issue 10 months ago • 2 comments

2024/05/01 15:38:26 App): reindexing

Failed to update last_indexed_at of user . pq: unexpected Parse response 'C'

Error: sql: transaction has already been committed or rolled back

louischan-oursky avatar May 01 '24 15:05 louischan-oursky

I suspect there is some race condition in this line:

https://github.com/authgear/authgear-server/blob/main/cmd/authgear/elasticsearch/reindex.go#L229-L231

The problem maybe UpdateLastIndexedAt is using the same db handle used by QueryPage, which internally assigning a same variable in HookHandle tx. I guess maybe they are running at the same time causing the problem.
Maybe we should UpdateLastIndexedAt in a queue.

tung2744 avatar May 03 '24 06:05 tung2744

@tung2744 do we still observe this problem in staging?

fungc-io avatar May 21 '24 08:05 fungc-io