-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathio_capacity_fix.patch
More file actions
45 lines (33 loc) · 1.53 KB
/
Copy pathio_capacity_fix.patch
File metadata and controls
45 lines (33 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
--- a/src/conn/conn_capacity.c
+++ b/src/conn/conn_capacity.c
@@ -36,7 +36,16 @@ __capacity_config(WT_SESSION_IMPL *session, const char *cfg[])
conn = S2C(session);
chunkcache = total = 0;
- WT_RET(__wt_config_gets(session, cfg, "io_capacity.total", &cval));
+ /*
+ * 添加配置解析错误检查
+ * 如果用户使用了错误的格式(如方括号而不是圆括号),
+ * 返回更友好的错误信息而不是crash
+ */
+ ret = __wt_config_gets(session, cfg, "io_capacity.total", &cval);
+ if (ret != 0)
+ WT_RET_MSG(session, EINVAL,
+ "invalid io_capacity configuration format. Use 'io_capacity=(total=<value>)' "
+ "with parentheses, not brackets");
+
if (cval.val != 0) {
if (cval.val < WT_THROTTLE_MIN)
WT_RET_MSG(session, EINVAL, "total I/O capacity value %" PRId64 " below minimum %d",
@@ -44,7 +53,12 @@ __capacity_config(WT_SESSION_IMPL *session, const char *cfg[])
total = (uint64_t)cval.val;
}
- WT_RET(__wt_config_gets(session, cfg, "io_capacity.chunk_cache", &cval));
+ ret = __wt_config_gets(session, cfg, "io_capacity.chunk_cache", &cval);
+ if (ret != 0 && ret != WT_NOTFOUND)
+ WT_RET_MSG(session, EINVAL,
+ "invalid io_capacity.chunk_cache configuration format. Use 'io_capacity=(chunk_cache=<value>)' "
+ "with parentheses, not brackets");
+
if (cval.val != 0) {
chunkcache = (uint64_t)cval.val;
if (chunkcache < WT_THROTTLE_MIN)