postgresql - 为什么 HangFire 启动过程会因此错误而失败?
问题描述
我们在启动使用 HangFire (1.6.22) 和 PostgreSQL 的进程时看到此错误。
2019-03-19 00:12:45,406 [1] ERROR
Hangfire.PostgreSql.PostgreSqlStorage [(null)] - Error while executing install/upgrade Npgsql.PostgresException (0x80004005): 42701: column "updatecount" of relation "lock" already exists
at Npgsql.NpgsqlConnector.<>c__DisplayClass161_0.<<ReadMessage>g__ReadMessageLong|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Npgsql.NpgsqlConnector.<>c__DisplayClass161_0.<<ReadMessage>g__ReadMessageLong|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Npgsql.NpgsqlDataReader.<NextResult>d__46.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Npgsql.NpgsqlDataReader.NextResult()
at Npgsql.NpgsqlCommand.<ExecuteDbDataReader>d__100.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Npgsql.NpgsqlCommand.<ExecuteNonQuery>d__92.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Npgsql.NpgsqlCommand.ExecuteNonQuery()
解决方案
固定。这可能会帮助其他人,我们所做的。
真正的问题是,当我们为 HangFire 创建表时,它是使用源代码库中可用的 SQL 脚本创建的。当代码运行时,它发现一些不匹配并自动尝试更新数据库表,但失败了。
所以我们删除了所有的表,让 HangFire 在第一次运行时创建表。现在工作正常。
推荐阅读
- wordpress - 如何在不同的托管 WP 中复制 ACP Pro 设置?
- pgp - 需要在 Kleopatra 中对 PGP 密钥“更改所有者信任”
- php - PHP:API返回二进制字符串,无法从中创建图像
- javascript - 如何使用 Javascript 重写链接之间的文本
- c# - ASP.NET Core 传递可枚举的对象以在控制器上获取操作
- node.js - Dynamodb 数据库查询中的时间戳比较未按预期工作
- rest - MultiPart PUT 请求在 Spring Boot 中不起作用
- winapi - 如何在 x86 程序集中按值传递结构
- kubernetes - minikube 无法在 mac 上启动
- java - 用 JOLT 通过字典替换数据值