22
22
import org .apache .kafka .common .utils .Time ;
23
23
import org .apache .kafka .coordinator .transaction .TransactionLogConfig ;
24
24
import org .apache .kafka .server .config .ServerLogConfigs ;
25
- import org .apache .kafka .server .log .remote .storage .RemoteLogManager ;
26
25
import org .apache .kafka .server .util .Scheduler ;
27
26
import org .apache .kafka .storage .log .metrics .BrokerTopicStats ;
28
27
@@ -64,11 +63,11 @@ public static UnifiedLog createLog(File dir,
64
63
Optional .empty (), // topicId
65
64
new ConcurrentHashMap <>(), // numRemainingSegments
66
65
false , // remoteStorageSystemEnable
67
- Optional .empty (), // remoteLogManager
68
66
LogOffsetsListener .NO_OP_OFFSETS_LISTENER
69
67
);
70
68
}
71
69
70
+ @ SuppressWarnings ("ParameterNumber" )
72
71
public static UnifiedLog createLog (File dir ,
73
72
LogConfig config ,
74
73
BrokerTopicStats brokerTopicStats ,
@@ -83,7 +82,6 @@ public static UnifiedLog createLog(File dir,
83
82
Optional <Uuid > topicId ,
84
83
ConcurrentMap <String , Integer > numRemainingSegments ,
85
84
boolean remoteStorageSystemEnable ,
86
- Optional <RemoteLogManager > remoteLogManager ,
87
85
LogOffsetsListener logOffsetsListener ) throws IOException {
88
86
return UnifiedLog .create (
89
87
dir ,
@@ -98,7 +96,7 @@ public static UnifiedLog createLog(File dir,
98
96
producerIdExpirationCheckIntervalMs ,
99
97
new LogDirFailureChannel (10 ),
100
98
lastShutdownClean ,
101
- topicId , // 直接傳入 Java Optional
99
+ topicId ,
102
100
numRemainingSegments ,
103
101
remoteStorageSystemEnable ,
104
102
logOffsetsListener
@@ -119,10 +117,9 @@ public static class LogConfigBuilder {
119
117
private int segmentIndexBytes = ServerLogConfigs .LOG_INDEX_SIZE_MAX_BYTES_DEFAULT ;
120
118
private long fileDeleteDelayMs = ServerLogConfigs .LOG_DELETE_DELAY_MS_DEFAULT ;
121
119
private boolean remoteLogStorageEnable = LogConfig .DEFAULT_REMOTE_STORAGE_ENABLE ;
122
- private boolean remoteLogCopyDisable = false ;
123
- private boolean remoteLogDeleteOnDisable = false ;
120
+ private boolean remoteLogCopyDisable = LogConfig . DEFAULT_REMOTE_LOG_COPY_DISABLE_CONFIG ;
121
+ private boolean remoteLogDeleteOnDisable = LogConfig . DEFAULT_REMOTE_LOG_DELETE_ON_DISABLE_CONFIG ;
124
122
125
- // 2. 為每個參數建立一個 "with" 方法,用於設定值並回傳 builder 本身 (fluent interface)
126
123
public LogConfigBuilder withSegmentMs (long segmentMs ) {
127
124
this .segmentMs = segmentMs ;
128
125
return this ;
0 commit comments