[IOTDB-4110] customize trigger snapshot#7286
Conversation
SzyWilliam
left a comment
There was a problem hiding this comment.
Thanks for working on this! There are some issues need to be fixed, PTAL. Also, use mvn spotless to format code before push.
| private int retentionFileNum = RaftServerConfigKeys.Snapshot.RETENTION_FILE_NUM_DEFAULT; | ||
| private long triggerSnapshotTime = 60; | ||
| private long triggerSnapshotFileSize = 20L << 30; | ||
|
|
There was a problem hiding this comment.
Add comments here. 60 seconds and 20 GB.
| .getCurrentDir(); | ||
| } | ||
| catch (IOException e) { | ||
| failed(new RatisGetDivisionException(e)); |
There was a problem hiding this comment.
failed(...) is called when construct a fail reply message to client. Just use log.warn here to warn user of GetDivisionException.
| failed(new RatisGetDivisionException(e)); | ||
| } | ||
|
|
||
| long currentDirLength = currentDir.length(); |
There was a problem hiding this comment.
File.length() will return
Returns the length of the file denoted by this abstract pathname. The return value is unspecified if this pathname denotes a directory.
Not the directory total size. Please refer to java doc https://docs.oracle.com/javase/8/docs/api/java/io/File.html#length--
|
|
||
| ScheduledExecutorUtil.safelyScheduleWithFixedDelay( | ||
| executor, | ||
| command, |
There was a problem hiding this comment.
Use this::triggerSnapshotByCustomize instead of lambda.
| return ConsensusGenericResponse.newBuilder().setSuccess(reply.isSuccess()).build(); | ||
| } | ||
|
|
||
| private void triggerSnapshotByCustomize(ConsensusConfig config) { |
There was a problem hiding this comment.
maybe we should add synchronized to method signature. Consider this: this method is not finished when 60s past and another call started.
|
@HHoflittlefish777 Thanks for the update. Could you please see if you can add some unit tests to verify this? |
Description
Content1 ...
Content2 ...
Content3 ...
This PR has:
for an unfamiliar reader.
for code coverage.
Key changed/added classes (or packages if there are too many classes) in this PR