Skip to content

Commit 572fbd0

Browse files
author
Ubuntu
committed
Refactor TestLinearWriteSpeed to use array type for records
1 parent 381ec4f commit 572fbd0

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/admin/ReconfigurableQuorumIntegrationTest.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,15 @@ public void testRemoveAndAddVoterWithInconsistentClusterId() throws Exception {
113113
try (Admin admin = Admin.create(cluster.clientProperties())) {
114114
Uuid dirId = cluster.nodes().controllerNodes().get(3000).metadataDirectoryId();
115115
var removeFuture = admin.removeRaftVoter(
116-
3000,
117-
dirId,
118-
new RemoveRaftVoterOptions().setClusterId(Optional.of("inconsistent"))
116+
3000,
117+
dirId,
118+
new RemoveRaftVoterOptions().setClusterId(Optional.of("inconsistent"))
119119
).all();
120120
TestUtils.assertFutureThrows(InconsistentClusterIdException.class, removeFuture);
121121

122-
var addFuture = admin.addRaftVoter(
123-
3000,
124-
dirId,
125-
Set.of(new RaftVoterEndpoint("CONTROLLER", "example.com", 8080)),
126-
new AddRaftVoterOptions().setClusterId(Optional.of("inconsistent"))
127-
).all();
122+
var addFuture = admin.addRaftVoter(3000, dirId,
123+
Set.of(new RaftVoterEndpoint("CONTROLLER", "example.com", 8080)),
124+
new AddRaftVoterOptions().setClusterId(Optional.of("inconsistent"))).all();
128125
TestUtils.assertFutureThrows(InconsistentClusterIdException.class, addFuture);
129126
}
130127
}

jmh-benchmarks/src/main/java/org/apache/kafka/jmh/log/TestLinearWriteSpeed.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,12 @@ static class LogWritable implements Writable {
238238
MemoryRecords messages;
239239
UnifiedLog log;
240240
Compression compression;
241-
List<SimpleRecord> recordsList;
241+
SimpleRecord[] records;
242242

243243
public LogWritable(File dir, LogConfig config, Scheduler scheduler, MemoryRecords messages, Compression compression, List<SimpleRecord> recordsList) throws IOException {
244244
this.messages = messages;
245245
this.compression = compression;
246-
this.recordsList = recordsList;
246+
this.records = recordsList.toArray(new SimpleRecord[0]);
247247
Utils.delete(dir);
248248
this.log = UnifiedLog.create(
249249
dir,
@@ -266,7 +266,7 @@ public LogWritable(File dir, LogConfig config, Scheduler scheduler, MemoryRecord
266266
}
267267

268268
public int write() {
269-
this.messages = MemoryRecords.withRecords(compression, recordsList.toArray(new SimpleRecord[0]));
269+
this.messages = MemoryRecords.withRecords(compression, records);
270270
log.appendAsLeader(
271271
messages,
272272
0,

0 commit comments

Comments
 (0)