出现了事务问题,在使用5.7.25-OceanBase_CE-v4.2.5.6 单机版本是正常的 使用5.7.25-OceanBase_CE-v4.2.5.4 sql版本的时候出现Volo.Abp.Data.AbpDbConcurrencyException: The database operation was expected to affect 1 row(s), but actually affected 0 row(s); data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.
inbiz_inbiz-deploy.1.vdn71sh2swbx@edoc2migrate | —> Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException: The database operation was expected to affect 1 row(s), but actually affected 0 row(s); data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.
没看明白
修改过事务隔离级别吗,信息太少了。需要快速解决问题,要给出问题背景,连接配置,报错日志等等
具体怎么使用 具体的操作 截图发一下 要不然没有办法看问题
发下截图看看
var isonlationLevel = EDoc2Utility.GetIsolationLevel((suggestIsolationLevel) =>
{
if (suggestIsolationLevel == null)
return null;
return InBizZipHelper.IsSiteModule(ZipModuleEnum) ? suggestIsolationLevel : null;
});
using var newUnitOfWork = UnitOfWorkManager.Begin(true, true, isolationLevel: isonlationLevel);
TryInitServiceProvider();
ExportModuleOutputDto result;
try
{
using (CancellationTokenProvider.Use(token))
{
if (!token.IsCancellationRequested)
{
var percent = InBizZipHelper.ProcessPercent(input.Contains);
SetIntervalPercent(process, percent.Percent, token);
var logStartMsg = GetLogMessage(input.NewAppName, TaskTypeEnum.Import,
ProcessStateEnum.Start);
Logger.LogInformation(logStartMsg.backEndLog);
process.UpdateProcessInfo(0, msg: logStartMsg.userFriendLyLog);
//导入、更新、发布的时候都需要屏蔽掉针对定制功能的InBizEfCoreRepositoryBase基类的相关操作
//比如导入一条标准数据,数据如果实现了ICustomized的话会自动变成定制数据,这个时候还是让它是标准数据而不是定制数据
//同理更新应用和发布应用也是一样道理
using (DataFilter.Enable<ICustomizedDisabledForChange>())
{
await ImportModuleAsync(input);
//流程提前完成了 不再完成
if (ZipModuleEnum != ZipContainsEnum.WorkFlow)
{
await newUnitOfWork.CompleteAsync(token);
}
}
var logEndMsg = GetLogMessage(input.NewAppName, TaskTypeEnum.Import,
ProcessStateEnum.End);
process.UpdateProcessInfo(percent.Percent / Constants.PercentRatio,
msg: logEndMsg.userFriendLyLog);
Logger.LogInformation(logEndMsg.backEndLog);
result = new ExportModuleOutputDto(true, string.Empty, string.Empty, ZipModuleEnum);
}
else
{
var logCancelMsg = GetLogMessage(input.NewAppName, TaskTypeEnum.Import,
ProcessStateEnum.Cancel);
Logger.LogError(logCancelMsg.backEndLog);
result = new ExportModuleOutputDto(true, logCancelMsg.userFriendLyLog, logCancelMsg.backEndLog, ZipModuleEnum);
}
}
}
catch (OperationCanceledException ex)
{
Logger.LogError(ex, ex.Message);
if (token.CanBeCanceled && !token.IsCancellationRequested)
{
result = await HandleImportException(input, cts, token, newUnitOfWork, ex);
}
else
{
//ReSharper disable once MethodSupportsCancellation
await newUnitOfWork.RollbackAsync();
AppPrintLogCache.AddLog(input.NewAppId, $"其他模块取消{ZipModuleEnum.ToString()}", input.AppType);
return new ExportModuleOutputDto(true, "其他模块取消", string.Empty, ZipModuleEnum);
}
}
catch (Exception ex)
{
Logger.LogError(ex, ex.Message);
result = await HandleImportException(input, cts, token, newUnitOfWork, ex);
}
隔离级别没有换 只是兼容 如果是oceanbase的数据库就使用读提交
测试的时候 数据库的数据也是保持一直么?用的隔离级别是 RC是吧 data may have been modified or deleted since entities were loaded. 从这句话来看 好像数据被删除了或者修改了 observer.log日志有么?
主要是我们本地测试是正常的,放到客户环境就炸,我们看不到对应的日志,使用的.net的abp ef,是不是数据库有什么相关的配置会影响?有没得什么特殊的配置?看着是并发冲突,但是我本地安装的你们这个4.2.5.7和4.2.5.6都是正常的 所以要求客户也升级了,但是升级了还是这个问题,迷茫了
再说一下 我们本地环境使用的是命令安装 客户环境是使用ocp部署
主要没有日志 不好判断问题的原因
没有办法回应了
2025-12-31 11:28:37.294 +08:00 Error] Volo.Abp.AspNetCore.Mvc.ExceptionHandling.AbpExceptionFilter
| ---------- RemoteServiceErrorInfo ----------
| exception url: /inbiz/api/services/engines/v3/app
| {
| “code”: null,
| “message”: “你提交的数据已经被其他用户/客户端修改.请放弃你所做的修改并再次尝试.”,
| “details”: null,
| “data”: null,
| “validationErrors”: null
| }
|
|
| [2025-12-31 11:28:37.296 +08:00 Error] Volo.Abp.AspNetCore.Mvc.ExceptionHandling.AbpExceptionFilter
| The database operation was expected to affect 1 row(s), but actually affected 0 row(s); data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.
| Volo.Abp.Data.AbpDbConcurrencyException: The database operation was expected to affect 1 row(s), but actually affected 0 row(s); data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.
你们使用obproxy了么?如果有 是一样的版本么?直连验证一下 看看是否报错
obroxy是什么意思
是obproxy 我打错了
版本不一致
版本不一致会影响吗
不确定是否会有影响 但是你本地可以保持一致 在测试一下
我们这边连上有问题的数据库了 但是还是报上面这个问题 我不知道怎么解决了 配置上有什么特殊的吗
