|
85 | 85 |
|
86 | 86 | change_attribute/1, |
87 | 87 |
|
88 | | - otp_6278/1, otp_10131/1, otp_16768/1, otp_16809/1]). |
| 88 | + otp_6278/1, otp_10131/1, otp_16768/1, otp_16809/1, |
| 89 | + |
| 90 | + decrease_size_with_chunk_step/1]). |
89 | 91 |
|
90 | 92 | -export([head_fun/1, hf/0, lserv/1, |
91 | 93 | measure/0, init_m/1, xx/0]). |
@@ -159,7 +161,7 @@ groups() -> |
159 | 161 | {change_size, [], |
160 | 162 | [change_size_before, change_size_during, |
161 | 163 | change_size_after, default_size, change_size2, |
162 | | - change_size_truncate]}]. |
| 164 | + change_size_truncate, decrease_size_with_chunk_step]}]. |
163 | 165 |
|
164 | 166 | init_per_suite(Config) -> |
165 | 167 | Config. |
@@ -4203,6 +4205,28 @@ otp_16809(Conf) when is_list(Conf) -> |
4203 | 4205 | HeadFunc2 = info(Log, head, undef), |
4204 | 4206 | ok = disk_log:close(Log). |
4205 | 4207 |
|
| 4208 | +decrease_size_with_chunk_step(Conf) when is_list(Conf) -> |
| 4209 | + Dir = ?privdir(Conf), |
| 4210 | + Log = test, |
| 4211 | + File = filename:join(Dir, lists:concat([Log, ".LOG"])), |
| 4212 | + {ok, test} = disk_log:open([{size, {1000, 3}}, {name,Log},{type, wrap}, |
| 4213 | + {file, File}, {notify, true}]), |
| 4214 | + eof = disk_log:chunk(Log,start,1), |
| 4215 | + {error, end_of_log} = disk_log:chunk_step(Log,start,1), |
| 4216 | + [disk_log:log(Log, X) || X <- lists:seq(1, 1000)], |
| 4217 | + ok = disk_log:close(Log), |
| 4218 | + {ok, test} = disk_log:open([{name, Log}, {type, wrap}, {file, File}, |
| 4219 | + {notify, true}]), |
| 4220 | + %% Decrease maximum number of files from 10 to 2. |
| 4221 | + ok = disk_log:change_size(Log, {1000, 2}), |
| 4222 | + %% The exception error of rem/2 operator should not occur in here. |
| 4223 | + {ok, _} = disk_log:chunk_step(Log, start, 1), |
| 4224 | + %% Continue to append the items to the log in order to make sure it can work |
| 4225 | + %% as normal. |
| 4226 | + [disk_log:log(Log, X) || X <- lists:seq(1, 5000)], |
| 4227 | + ok = disk_log:close(Log), |
| 4228 | + del(File, 2). |
| 4229 | + |
4206 | 4230 | mark(FileName, What) -> |
4207 | 4231 | {ok,Fd} = file:open(FileName, [raw, binary, read, write]), |
4208 | 4232 | {ok,_} = file:position(Fd, 4), |
|
0 commit comments