Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unit basic 问题汇总 #1641

Closed
wang1309 opened this issue Jun 23, 2023 · 5 comments
Closed

unit basic 问题汇总 #1641

wang1309 opened this issue Jun 23, 2023 · 5 comments
Assignees

Comments

@wang1309
Copy link
Contributor

wang1309 commented Jun 23, 2023

[err]: DBSIZE in tests/unit/basic.tcl
[err]: DBSIZE should be 10101 now in tests/unit/basic.tcl
原因:没有执行过key统计相关的操作。
解决:执行 RunKeyScan 函数, pr: Basic
风险:该函数的时间复杂度是 O(N), 如果大量执行dbsize命令可能会导致线程耗尽。
可能的优化方向:维护一个全局统计计数或者想想其他办法。

[err]: INCR fails against key with spaces (left) in tests/unit/basic.tcl
[err]: INCR fails against a key holding a list in tests/unit/basic.tcl
[err]: INCRBYFLOAT fails against a key holding a list in tests/unit/basic.tcl
原因:目前 INCR、INCRBYFLOAT 相关命令直接使用的 strDb 对象,而且似乎pika目前没有维护key与key type 之间的关系。所以暂时也不好做类型校验。
解决:目前暂未解决。
可能的解决方案:使用map维护key与key type的映射关系,看大佬们的建议有没有必要做这个。
缺点:内存和磁盘占用相比原来变大,磁盘IO变高。

[err]: INCRBYFLOAT does not allow NaN or Infinity in tests/unit/basic.tcl
原因:这个主要是因为pika的错误提示和单测不一致。
解决:已改为以redis 错误提示为准。

[exception]: Executing test client: ERR unknown command "debug".
原因:命令未实现。
解决:这个命令用的不多,感觉可以暂时不实现。

[exception]: Executing test client: ERR unknown command "rename".
原因:命令未实现
解决:Todo 实现这个命令

@machinly
Copy link
Collaborator

  1. 非差异化命令的错误信息应与 redis 对齐,因为客户端可能会依赖错误信息进行进一步的处理。
    可以修改 pika 的错误信息,而不是单测。
  2. 每个 pr 只修复一个问题,可以容易去追踪问题,也方便找合适的人去 review。当然如果一处修复恰好可以解决多个问题,也是可以的。
  3. debug 命令相关的可以直接在 tcl 脚本中注释掉。

@wang1309
Copy link
Contributor Author

ok

@machinly
Copy link
Collaborator

关于增加 RunKeyScan 函数。
pika 设计并不支持实时统计,但有线程去扫描。可以参考 docs/ops/bestPractice.md pika最佳实践之十六.

针对测试修复,可以在 tcl 脚本的 dbsize 前添加 r info keyspace 1 来触发 keyscan。
另外由于 keyscan 为异步操作,可能触发后并不会立即完成,可以在r dbsize 前添加 after 1000 来 +1s。
更优雅的做法是实现一个函数来等待扫描结束,函数内循环直到 is_scaning_keyspace 为 No,可以参考 tests/support/util.tcl 中的 proc waitForBgsave,不过测试数据量不大,after 即可 。

@machinly machinly assigned machinly and wang1309 and unassigned machinly Jun 24, 2023
@wang1309
Copy link
Contributor Author

关于增加 RunKeyScan 函数。 pika 设计并不支持实时统计,但有线程去扫描。可以参考 docs/ops/bestPractice.md pika最佳实践之十六.

针对测试修复,可以在 tcl 脚本的 dbsize 前添加 r info keyspace 1 来触发 keyscan。 另外由于 keyscan 为异步操作,可能触发后并不会立即完成,可以在r dbsize 前添加 after 1000 来 +1s。 更优雅的做法是实现一个函数来等待扫描结束,函数内循环直到 is_scaning_keyspace 为 No,可以参考 tests/support/util.tcl 中的 proc waitForBgsave,不过测试数据量不大,after 即可 。

ok

@AlexStocks
Copy link
Collaborator

    * 单测 刘振已经提交了 pr https://github.com/OpenAtomFoundation/pika/pull/1357 baitao,maxin,常顺宇
        * 0415 需要刘振继续验证    
        * 0429 显荣 推荐,可以借鉴 https://github.com/jianqingdu/kedis/tree/master/tests
        * 0506 老 pr 已经 merge,看怎么集成进 github action ci
        * 0520 baitao,常顺宇 后面微调一下,让ut跑起来,https://github.com/OpenAtomFoundation/pika/pull/1538
        * 0527 目前已经能跑单测,其他任务待跟进;待加上单测相关的 CI;
          * 0610 https://github.com/OpenAtomFoundation/pika/pull/1604(待合并)
          * 0610 任务拆分:https://github.com/OpenAtomFoundation/pika/issues/1605
        * 0617 
          * maxin:拆开了任务,分出去去做了,可以在群里说一下,大家一起做一下
          * hao 测试了string,在了解 geo
    * pika: 差异化命令类型API 单元测试用例。增加针对 pika 独有的命令的ut:https://github.com/OpenAtomFoundation/pika/issues/1257
        * 0520 部分命令不完全对应,需要整理差异,wiki有几年前的一个列表供参考:https://github.com/OpenAtomFoundation/pika/wiki/pika-%E5%B7%AE%E5%BC%82%E5%8C%96%E5%91%BD%E4%BB%A4
        * 0603 baitao 提了PR https://github.com/OpenAtomFoundation/pika/pull/1577 ,待CR,maxin CR 这个 PR 完列一个列表
        * 0603 hao 和 baitao、maxin 联系
        * 0617 合并到与单测任务一起,中止跟进

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants