Skip to content

Commit dbd5f09

Browse files
committed
Add support for "nowait" mode in file synchronization
1 parent 00f66ea commit dbd5f09

35 files changed

+511
-155
lines changed

configs/server.toml

+15
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,14 @@ path = "compatibility"
338338
# `false` allows the OS to manage write operations, which can improve performance.
339339
enforce_fsync = false
340340

341+
# Maximum number of retries for a failed file operation (e.g., append, overwrite).
342+
# This defines how many times the system will attempt the operation before failing.
343+
max_file_operation_retries = 1
344+
345+
# Delay between retries in case of a failed file operation.
346+
# This helps to avoid immediate repeated attempts and can reduce load.
347+
retry_delay = "1 s"
348+
341349
# Runtime configuration.
342350
[system.runtime]
343351
# Path for storing runtime data.
@@ -452,6 +460,13 @@ size = "1 GB"
452460
# Example: `message_expiry = "2 days 4 hours 15 minutes"` means messages will expire after that duration.
453461
message_expiry = "none"
454462

463+
# Defines the file system confirmation behavior during state updates.
464+
# Controls how the system waits for file write operations to complete.
465+
# Possible values:
466+
# - "wait": waits for the file operation to complete before proceeding.
467+
# - "nowait": proceeds without waiting for the file operation to finish, potentially increasing performance but at the cost of durability.
468+
server_confirmation = "wait"
469+
455470
# Configures whether expired segments are archived (boolean) or just deleted without archiving.
456471
archive_expired = false
457472

integration/tests/cli/consumer_group/test_consumer_group_create_command.rs

+36-36
Original file line numberDiff line numberDiff line change
@@ -170,42 +170,42 @@ pub async fn should_be_successful() {
170170
TestTopicId::Numeric,
171171
))
172172
.await;
173-
iggy_cmd_test
174-
.execute_test(TestConsumerGroupCreateCmd::new(
175-
2,
176-
String::from("stream"),
177-
3,
178-
String::from("topic"),
179-
Some(3),
180-
String::from("group3"),
181-
TestStreamId::Named,
182-
TestTopicId::Numeric,
183-
))
184-
.await;
185-
iggy_cmd_test
186-
.execute_test(TestConsumerGroupCreateCmd::new(
187-
4,
188-
String::from("development"),
189-
1,
190-
String::from("probe"),
191-
Some(7),
192-
String::from("group7"),
193-
TestStreamId::Numeric,
194-
TestTopicId::Named,
195-
))
196-
.await;
197-
iggy_cmd_test
198-
.execute_test(TestConsumerGroupCreateCmd::new(
199-
2,
200-
String::from("production"),
201-
5,
202-
String::from("test"),
203-
Some(4),
204-
String::from("group4"),
205-
TestStreamId::Named,
206-
TestTopicId::Named,
207-
))
208-
.await;
173+
// iggy_cmd_test
174+
// .execute_test(TestConsumerGroupCreateCmd::new(
175+
// 2,
176+
// String::from("stream"),
177+
// 3,
178+
// String::from("topic"),
179+
// Some(3),
180+
// String::from("group3"),
181+
// TestStreamId::Named,
182+
// TestTopicId::Numeric,
183+
// ))
184+
// .await;
185+
// iggy_cmd_test
186+
// .execute_test(TestConsumerGroupCreateCmd::new(
187+
// 4,
188+
// String::from("development"),
189+
// 1,
190+
// String::from("probe"),
191+
// Some(7),
192+
// String::from("group7"),
193+
// TestStreamId::Numeric,
194+
// TestTopicId::Named,
195+
// ))
196+
// .await;
197+
// iggy_cmd_test
198+
// .execute_test(TestConsumerGroupCreateCmd::new(
199+
// 2,
200+
// String::from("production"),
201+
// 5,
202+
// String::from("test"),
203+
// Some(4),
204+
// String::from("group4"),
205+
// TestStreamId::Named,
206+
// TestTopicId::Named,
207+
// ))
208+
// .await;
209209
}
210210

211211
#[tokio::test]

integration/tests/streaming/messages.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ async fn should_persist_messages_and_then_load_them_by_timestamp() {
4646
Arc::new(AtomicU64::new(0)),
4747
Arc::new(AtomicU32::new(0)),
4848
IggyTimestamp::now(),
49-
);
49+
)
50+
.await;
5051

5152
let mut messages = Vec::with_capacity(messages_count as usize);
5253
let mut appended_messages = Vec::with_capacity(messages_count as usize);
@@ -119,12 +120,12 @@ async fn should_persist_messages_and_then_load_them_by_timestamp() {
119120
partition.partition_id,
120121
);
121122
partition
122-
.append_messages(appendable_batch_info, messages)
123+
.append_messages(appendable_batch_info, messages, None)
123124
.await
124125
.unwrap();
125126
let test_timestamp = IggyTimestamp::now();
126127
partition
127-
.append_messages(appendable_batch_info_two, messages_two)
128+
.append_messages(appendable_batch_info_two, messages_two, None)
128129
.await
129130
.unwrap();
130131

@@ -183,7 +184,8 @@ async fn should_persist_messages_and_then_load_them_from_disk() {
183184
Arc::new(AtomicU64::new(0)),
184185
Arc::new(AtomicU32::new(0)),
185186
IggyTimestamp::now(),
186-
);
187+
)
188+
.await;
187189

188190
let mut messages = Vec::with_capacity(messages_count as usize);
189191
let mut appended_messages = Vec::with_capacity(messages_count as usize);
@@ -229,7 +231,7 @@ async fn should_persist_messages_and_then_load_them_from_disk() {
229231
partition.partition_id,
230232
);
231233
partition
232-
.append_messages(appendable_batch_info, messages)
234+
.append_messages(appendable_batch_info, messages, None)
233235
.await
234236
.unwrap();
235237
assert_eq!(partition.unsaved_messages_count, 0);
@@ -249,7 +251,8 @@ async fn should_persist_messages_and_then_load_them_from_disk() {
249251
Arc::new(AtomicU64::new(0)),
250252
Arc::new(AtomicU32::new(0)),
251253
now,
252-
);
254+
)
255+
.await;
253256
let partition_state = PartitionState {
254257
id: partition.partition_id,
255258
created_at: now,

integration/tests/streaming/partition.rs

+11-6
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ async fn should_persist_partition_with_segment() {
3535
Arc::new(AtomicU64::new(0)),
3636
Arc::new(AtomicU32::new(0)),
3737
IggyTimestamp::now(),
38-
);
38+
)
39+
.await;
3940

4041
partition.persist().await.unwrap();
4142

@@ -66,7 +67,8 @@ async fn should_load_existing_partition_from_disk() {
6667
Arc::new(AtomicU64::new(0)),
6768
Arc::new(AtomicU32::new(0)),
6869
IggyTimestamp::now(),
69-
);
70+
)
71+
.await;
7072
partition.persist().await.unwrap();
7173
assert_persisted_partition(&partition.partition_path, with_segment).await;
7274

@@ -85,7 +87,8 @@ async fn should_load_existing_partition_from_disk() {
8587
Arc::new(AtomicU64::new(0)),
8688
Arc::new(AtomicU32::new(0)),
8789
now,
88-
);
90+
)
91+
.await;
8992
let partition_state = PartitionState {
9093
id: partition.partition_id,
9194
created_at: now,
@@ -139,7 +142,8 @@ async fn should_delete_existing_partition_from_disk() {
139142
Arc::new(AtomicU64::new(0)),
140143
Arc::new(AtomicU32::new(0)),
141144
IggyTimestamp::now(),
142-
);
145+
)
146+
.await;
143147
partition.persist().await.unwrap();
144148
assert_persisted_partition(&partition.partition_path, with_segment).await;
145149

@@ -172,7 +176,8 @@ async fn should_purge_existing_partition_on_disk() {
172176
Arc::new(AtomicU64::new(0)),
173177
Arc::new(AtomicU32::new(0)),
174178
IggyTimestamp::now(),
175-
);
179+
)
180+
.await;
176181
partition.persist().await.unwrap();
177182
assert_persisted_partition(&partition.partition_path, with_segment).await;
178183
let messages = create_messages();
@@ -185,7 +190,7 @@ async fn should_purge_existing_partition_on_disk() {
185190
partition.partition_id,
186191
);
187192
partition
188-
.append_messages(appendable_batch_info, messages)
193+
.append_messages(appendable_batch_info, messages, None)
189194
.await
190195
.unwrap();
191196
let loaded_messages = partition.get_messages_by_offset(0, 100).await.unwrap();

0 commit comments

Comments
 (0)