Commit c72ce69
gpcheckperf: Fix memory calculation function (#14865)
* gpcheckperf: Fix memory calculation function
Currently, there is a bug in the `getMemory()` function in `gpcheckperf` because of the way we check the return code of the `run()` method which is called inside `getMemory()`. The `run()` method returns an integer value of `zero` in case of success and a `non-zero` value if it fails.
We are checking this value using the condition `if not ok` which is incorrect because when the `run()` method succeeds (`ok = 0`), the condition would result as `False` causing the `getMemory()` function to assume that the `run()` method failed but in reality, it did not.
A simple fix would be to change the condition from `if not ok` to `if ok != 0` to check for any possible failure from the `run()` method.
Further, the way `getMemory()` handles errors is also incorrect. It just returns `0` whenever there is an error which can lead to the incorrect file size being used to perform disk performance tests. This is because the gpcheckperf utility internally calls `multidd` command to perform disk performance tests which also accepts a file size parameter with the -S option which when not set (or is equal to 0), uses its own default value of `2 * memory_size`, but instead of dividing it from the number of input directories, it uses this value for each directory i.e. the total file size value would be `2 * memory_size * no_of_input_directories`. Due to this, sometimes the user can meet File System Full error when the number of input directories is big.
Hence we need to properly handle the error in the `getMemory()` function and exit from the code instead of just returning `0`
Before:
```
$ gpcheckperf -d /tmp/test1 -d /tmp/test2 -d /tmp/test3 -h localhost -rd
disk write avg time (sec): 5.46
disk write tot bytes: 12884901888 --> is equal to 2 * memory_size * no_of_input_directories
disk write tot bandwidth (MB/s): 2250.55
disk write min bandwidth (MB/s): 2250.55 [localhost]
disk write max bandwidth (MB/s): 2250.55 [localhost]
```
After:
```
$ gpcheckperf -d /tmp/test1 -d /tmp/test2 -d /tmp/test3 -h localhost -rd
disk write avg time (sec): 1.87
disk write tot bytes: 4295000064 --> is equal to 2 * memory_size
disk write tot bandwidth (MB/s): 2190.39
disk write min bandwidth (MB/s): 2190.39 [localhost]
disk write max bandwidth (MB/s): 2190.39 [localhost]
```
Also added unit test cases to test the getMemory() function outputs and added a main section to the gpcheckperf code.1 parent 2528f32 commit c72ce69
3 files changed
Lines changed: 136 additions & 49 deletions
File tree
- gpMgmt
- bin
- gppylib/test/unit
- test/behave/mgmt_utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
140 | 142 | | |
141 | 143 | | |
142 | 144 | | |
143 | 145 | | |
144 | | - | |
145 | | - | |
| 146 | + | |
146 | 147 | | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
151 | 152 | | |
152 | 153 | | |
153 | | - | |
| 154 | + | |
154 | 155 | | |
155 | | - | |
| 156 | + | |
156 | 157 | | |
157 | 158 | | |
158 | 159 | | |
| |||
261 | 262 | | |
262 | 263 | | |
263 | 264 | | |
264 | | - | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
265 | 271 | | |
266 | 272 | | |
267 | 273 | | |
| |||
947 | 953 | | |
948 | 954 | | |
949 | 955 | | |
950 | | - | |
951 | | - | |
952 | | - | |
953 | | - | |
954 | | - | |
| 956 | + | |
955 | 957 | | |
956 | | - | |
957 | | - | |
958 | | - | |
959 | | - | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
960 | 968 | | |
961 | | - | |
962 | | - | |
| 969 | + | |
| 970 | + | |
963 | 971 | | |
964 | | - | |
965 | | - | |
966 | | - | |
967 | | - | |
968 | | - | |
969 | | - | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
970 | 978 | | |
971 | | - | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
972 | 986 | | |
973 | | - | |
974 | | - | |
975 | | - | |
976 | | - | |
977 | | - | |
| 987 | + | |
| 988 | + | |
978 | 989 | | |
979 | | - | |
980 | | - | |
| 990 | + | |
| 991 | + | |
981 | 992 | | |
982 | | - | |
983 | | - | |
| 993 | + | |
| 994 | + | |
984 | 995 | | |
985 | | - | |
986 | | - | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
987 | 1000 | | |
988 | | - | |
989 | | - | |
990 | | - | |
991 | | - | |
| 1001 | + | |
992 | 1002 | | |
993 | | - | |
| 1003 | + | |
| 1004 | + | |
994 | 1005 | | |
995 | | - | |
996 | | - | |
| 1006 | + | |
| 1007 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
0 commit comments