| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
fix: CaptureLastError重构为SetLastErrorMsg(statement->GetLastErrorMsg)+capturedErrMsg_重命名errorMsg_+BuildColumnRangeCtx拆分+JS_ERROR_CODE_MSGS按nativeCode严格递增排序+并发/反复报错测试用例补充 - rdb_store_impl.cpp: CaptureLastError()重构为SetLastErrorMsg(msg), 从statement/connection直接获取LastErrorMsg而非遍历connectionPool, 移除statement==nullptr处的CaptureLastError调用(此时无statement无法获取消息) - rdb_store_impl.h: CaptureLastError→SetLastErrorMsg(const std::string &msg) - connection_pool.h/cpp: 移除ConnectionPool::GetLastErrorMsg()(不再需要遍历池) - sqlite_connection.h: SetLastErrorMsg改为public, 移除friend class SqliteStatement - abs_result_set.h/cpp: BuildColumnRangeCtx拆分为BuildColumnNameNotFoundCtx/BuildColumnIndexRangeCtx/BuildColumnUnknownCtx三个场景化函数 - step_result_set.cpp: GetValueObject列越界使用BuildColumnIndexRangeCtx/BuildColumnUnknownCtx - abs_shared_result_set.cpp: CheckState列越界使用BuildColumnIndexRangeCtx/BuildColumnUnknownCtx - napi_rdb_error.cpp: JS_ERROR_CODE_MSGS按nativeCode(status)值严格递增排序, 满足IsIncreasing()编译断言; NATIVE_ERR_MSG_MAP恢复为独立线性查找表+GetNativeErrMsg函数 - napi_rdb_error.h: 移除RDB_NAPI_ASSERT_INT宏(未使用) - napi_rdb_context.h/cpp: capturedErrMsg_重命名errorMsg_, SetError使用errorMsg_ - napi_rdb_store.cpp: exec_ lambda使用errorMsg_, clang-format长行拆分 - napi_transaction.cpp: capturedErrMsg_重命名errorMsg_, StealTransaction后增加CHECK_RETURN_ERR非空检查 - napi_result_set.cpp: null-check前置(RDB_NAPI_ASSERT), 移除opMsg中间变量, 直接从resultSet->GetLastErrorMsg()获取错误消息 - napi_lite_result_set.cpp: 同上null-check前置+直接GetLastErrorMsg - napi_async_call.h/napi_rdb_context.h: errorMsg_成员 - lite_result_set_impl.cpp/result_set_impl.cpp: GetRowsSync/GetRowsDataSync使用resultSet而非nativeResultSet获取LastErrorMsg - RdbErrMsgOptimize.test.ets: 补充5个用例(025-029): 异步并发不同错误消息验证、同步反复报错无交叉污染、不同错误类型反复报错验证 - RdbErrMsgRange.test.ets: 14个用例注释改为@tc.number/@tc.name/@tc.desc标准化格式 Signed-off-by: guochao <guochao76@h-partners.com> Co-Authored-By: Agent 🤖 AI[53%] 👌 AI Adopted[53%] 🧑 Human[47%] Change-Id: I01edd6428f06a57188053a0e8c7e726ccc9184a2 | 5 天前 | |
new feature of cloud sync Signed-off-by: wddhw <wangxiangdong13@huawei.com> | 2 个月前 | |
fix ut Co-Authored-By: Agent Signed-off-by: MengYao <mengyao17@h-partners.com> 🤖 AI[100%] 👌 AI Adopted[100%] 🧑 Human[0%] Co-authored-by: opencode (glm-5.1) <ai@local> | 7 天前 | |
!3429 merge fix/errmsg-concurrent-map into master fix: GetLastErrorMsg并发安全重构,ErrMsgStore替换为ConcurrentMap Created-by: guochao95 Commit-by: guochao95 Merged-by: openharmony_ci Description: * **IssueNo**: [#2636](https://gitcode.com/openharmony/distributeddatamgr_relational_store/issues/2636) * **Description**: GetLastErrorMsg并发安全重构,ErrMsgStore全局单例替换为线程隔离ConcurrentMap,错误消息拼接匿名dbPath * **Sig**: SIG_DataManagement * **Feature or Bugfix**: Bugfix * **Binary Source**: No * **TDD**: NA * **XTS**: pass  * **Pretest**: NA ### 主要改动: - 删除ErrMsgStore全局单例,改为线程隔离存储 - RdbStoreImpl/SqliteConnection: ConcurrentMap<thread_id, string> lastErrMsg_ - StepResultSet: std::string lastErrMsg_ + mutable globalMtx_ lock_guard - SqliteConnection::GetLastErrorMsg() 拼接匿名dbPath (SqliteUtils::Anonymous) - E_SQLITE_ERROR测试增加***断言验证匿名路径拼接 - 删除ErrMsgStoreTest测试target和err_msg_store.h/test文件 - abs_result_set.h: globalMtx_改为mutable ### 稳定性排查: - [x] 禁止在锁内向其他进程发送IPC - [x] 禁止将捕获栈变量引用的lambda函数异步到其他线程执行 - [x] 禁止传递this指针至其他模块或线程 - [x] 禁止存储string的c_str()方法获取到的指针 - [x] 成员变量进行赋值或创建需要排查并发 - [x] 谨慎在未经拷贝的情况下使用外部传入的string、C字符串 - [x] map/vector/list/set等stl模板类使用时需要排查并发 - [x] 谨慎考虑加锁范围,尽可能的小范围加锁 - [x] 在IPC通信中谨慎使用同步通信方式 - [x] 禁止将外部传入的裸指针在内部直接构造智能指针 - [x] 禁止多个独立创建的智能指针管理同一地址 - [x] 禁止在析构函数中抛异步任务 - [x] 禁止js对象在非js线程创建、使用或销毁 - [x] 禁止在对外接口中未经判空直接使用外部传入的指针 - [x] 监听回调要确保,回调触发和取消注册并发时无生命周期问题 - [x] 遍历容器进行删除或插入时注意迭代器失效问题 ### 日志打印排查: - [x] 禁止打印内存地址 - [x] 禁止明文打印密钥、文件路径等敏感信息 - [x] 禁止不作匿名化直接打印敏感信息 - [x] 非必要不要在循环内打印日志 ### 安全编码自检: - [x] 内存申请前必须对内存大小进行合法性校验 - [x] 内存申请后必须判空 - [x] 分配和释放内存的函数需要成对出现 - [x] 禁止使用realloc、alloca函数 - [x] 外部传入的路径要做规范化校验 - [x] 指针变量、表示资源描述符的变量必须赋初值 - [x] IPC流程中ReadCString等结果必须判空 - [x] 整数之间运算时必须严格检查确保不会出现溢出 - [x] 安全函数必须检查返回值并进行正确处理 - [x] 格式化打印类型需匹配 ### L0新增用例自检结果: - [x] 是,有新增L0用例,且完成自检 ### 代码开发保证基本逻辑正常: - [x] 是 See merge request: openharmony/distributeddatamgr_relational_store!3429 | 4 天前 | |
按照操作类型命名函数 Signed-off-by: guochao <guochao76@h-partners.com> | 2 个月前 |