GridManager Error: response.totals undefined,please check totalsKey

本文解决GridManager中出现的response.totalsundefined错误,通常由totalsKey配置不当引起。通过正确设置totalsKey或使用responseHandler可避免此问题。

在使用GridManager的时候,有时会出现以下错误:

GridManager Error: response.totals undefined,please check totalsKey

解决方法
这个错误是由于的返回的数据中未找到totals字段,并提示检查配置项totalsKey

如果totalsKey与接口返回字段不匹配,那么组件通过totalsKey获取到的将是undefined

比如接口返回格式如下:

{
	list: [
	{name:'baukh', age: 11},
	{name:'baukh2', age: 22}
	],
	sum: 2
}

由于totalsKey默认值为totals,当接口返回的总条数字段为sum时就需要在初始化时添加配置项: totalsKey: 'sum'

详情可参考API - totalsKey

如果当前未配置totalsKey: 'sum',将会报出GridManager Error: response.totals undefined,please check totalsKey错误。

除此之外配置项responseHandler也可以处理该问题,但responseHandler一般用于处理更为复杂的情况。

详情可参考API - responseHandler

刚开始的运行创建目录也是正常的 20:10:06.448 Flushing all reports 20:10:06.473 Creating anchor for /nfs/mnt2-0,fsd=fsd1 20:10:06.475 Creating anchor for /nfs/mnt2-1,fsd=fsd2 20:10:06.498 rd1 fsd to format: fsd1 20:10:06.498 rd1 format on host: localhost 20:10:06.498 rd1 fsd to format: fsd2 20:10:06.498 rd1 format on host: localhost 20:10:06.520 Anchor size: anchor=/nfs/mnt2-1: dirs: 14; files: 4,000,000; bytes: 762.939g (819,200,000,000) 20:10:06.521 Anchor size: anchor=/nfs/mnt2-0: dirs: 14; files: 800,000; bytes: 48.828g (52,428,800,000) 20:10:06.522 Estimated totals for all 2 anchors: dirs: 28; files: 4,800,000; bytes: 811.768g 20:10:06.603 Starting slave: /root/vdbench50407/vdbench SlaveJvm -m localhost -n localhost-10-251105-20.10.06.410 -l localhost-0 -p 5570 20:10:06.811 Slave localhost-0 (pid 14313) connected to master 14255 20:10:06.842 All slaves are now connected Link to Run Definitions: <A HREF="#_250075633">format_for_rd1 For loops: None</A> <A HREF="#_358699161">rd1 For loops: None</A> 20:10:06.967 Flushing all reports 20:10:06.968 slv=localhost-0 fwd=format fsd=fsd1 anchor=/nfs/mnt2-0 threads= 8 skew= 0.00 operation=read 20:10:06.968 slv=localhost-0 fwd=format fsd=fsd2 anchor=/nfs/mnt2-1 threads= 8 skew= 0.00 operation=read 20:10:06.988 Waiting for synchronization of all slaves 20:10:25.007 Synchronization of all slaves complete <a name="_250075633"></a><i><b>20:10:26.002 Starting RD=format_for_rd1</b></i> 20:10:26.465 localhost-0: anchor=/nfs/mnt2-1 mkdir complete. 20:10:26.466 localhost-0: anchor=/nfs/mnt2-0 mkdir complete. 20:10:27.352 localhost-0: anchor=/nfs/mnt2-0 create complete. Nov 05, 2025 ..Interval.. .ReqstdOps... ...cpu%... read ....read..... ....write.... ..mb/sec... mb/sec .xfer.. ...mkdir.... ...rmdir.... ...create... ....open.... ...close.... ...delete... rate resp total sys pct rate resp rate resp read write total size rate resp rate resp rate resp rate resp rate resp rate resp 20:10:36.042 1 608.5 11.030 20.8 0.98 0.0 0.0 0.000 608.5 11.030 0.00 59.43 59.43 102414 0.0 0.000 0.0 0.000 304.1 25.080 304.6 2.954 304.1 0.008 0.0 0.000 20:10:46.017 2 603.9 11.271 1.3 0.91 0.0 0.0 0.000 603.9 11.271 0.00 58.97 58.97 102395 0.0 0.000 0.0 0.000 302.0 26.473 302.0 3.875 302.0 0.007 0.0 0.000 20:10:56.013 3 583.9 11.390 1.0 0.78 0.0 0.0 0.000 583.9 11.390 0.00 57.02 57.02 102404 0.0 0.000 0.0 0.000 291.9 27.394 292.1 4.567 291.9 0.006 0.0 0.000 20:11:06.010 4 583.2 11.582 1.2 0.98 0.0 0.0 0.000 583.2 11.582 0.00 56.95 56.95 102390 0.0 0.000 0.0 0.000 291.7 27.431 291.5 4.215 291.7 0.006 0.0 0.000 20:11:16.013 5 598.2 11.263 1.3 1.11 0.0 0.0 0.000 598.2 11.263 0.00 58.43 58.43 102419 0.0 0.000 0.0 0.000 298.9 26.743 299.1 4.173 298.9 0.006 0.0 0.000 20:11:26.011 6 613.4 11.000 1.2 0.99 0.0 0.0 0.000 613.4 11.000 0.00 59.90 59.90 102390 0.0 0.000 0.0 0.000 306.8 26.084 306.6 4.043 306.8 0.006 0.0 0.000 20:11:36.009 7 588.6 11.423 1.1 0.97 0.0 0.0 0.000 588.6 11.423 0.00 57.48 57.48 102400 0.0 0.000 0.0 0.000 294.3 27.173 294.4 4.280 294.3 0.006 0.0 0.000
最新发布
11-07
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值