Skip to content

Commit fc8d452

Browse files
authored
apache/master->master: 15e20d7 (#1258)
2 parents c2f525c + 15e20d7 commit fc8d452

60 files changed

Lines changed: 1468 additions & 1345 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/api-reference/supervisor-api.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2508,11 +2508,16 @@ curl "http://ROUTER_IP:ROUTER_PORT/druid/indexer/v1/supervisor?skipRestartIfUnmo
25082508

25092509
```json
25102510
{
2511-
"id": "social_media"
2511+
"id": "social_media",
2512+
"restarted": true
25122513
}
25132514
```
25142515
</details>
25152516

2517+
The response includes the following fields:
2518+
- `id`: The supervisor ID.
2519+
- `restarted`: A boolean indicating whether the supervisor was restarted. When `skipRestartIfUnmodified` is set to `true` and the supervisor spec is unchanged, this field will be `false`; otherwise, it will be `true`.
2520+
25162521
### Suspend a running supervisor
25172522

25182523
Suspends a single running supervisor. Returns the updated supervisor spec, where the `suspended` property is set to `true`. The suspended supervisor continues to emit logs and metrics.

embedded-tests/src/test/java/org/apache/druid/testing/embedded/docker/IngestionBackwardCompatibilityDockerTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
import org.junit.jupiter.api.Assertions;
3838
import org.junit.jupiter.api.BeforeEach;
3939

40+
import java.util.Map;
41+
4042
/**
4143
* Runs some basic ingestion tests using Coordinator and Overlord at version
4244
* {@link DruidContainer.Image#APACHE_31} and other services at current version
@@ -111,6 +113,13 @@ protected int markSegmentsAsUnused(String dataSource)
111113
}
112114
}
113115

116+
@Override
117+
protected void validateSupervisorUpdateResponse(Map<String, String> startSupervisorResult, String supervisorId)
118+
{
119+
// Older Overlord versions did not include "restarted" in the API response.
120+
Assertions.assertEquals(Map.of("id", supervisorId), startSupervisorResult);
121+
}
122+
114123
@Override
115124
protected void waitForNextCoordinatorCacheSync()
116125
{

embedded-tests/src/test/java/org/apache/druid/testing/embedded/indexing/IngestionSmokeTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ public void test_runKafkaSupervisor()
297297
final Map<String, String> startSupervisorResult = cluster.callApi().onLeaderOverlord(
298298
o -> o.postSupervisor(kafkaSupervisorSpec)
299299
);
300-
Assertions.assertEquals(Map.of("id", supervisorId), startSupervisorResult);
300+
validateSupervisorUpdateResponse(startSupervisorResult, supervisorId);
301301

302302
waitForSegmentsToBeQueryable(1);
303303

@@ -417,6 +417,11 @@ private void waitForSegmentsToBeQueryable(int numSegments)
417417
);
418418
}
419419

420+
protected void validateSupervisorUpdateResponse(Map<String, String> startSupervisorResult, String supervisorId)
421+
{
422+
Assertions.assertEquals(Map.of("id", supervisorId, "restarted", "true"), startSupervisorResult);
423+
}
424+
420425
protected void waitForNextCoordinatorCacheSync()
421426
{
422427
eventCollector.latchableEmitter().waitForNextEvent(

indexing-service/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorResource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public Response specPost(
166166
}
167167

168168
if (Boolean.TRUE.equals(skipRestartIfUnmodified) && !manager.shouldUpdateSupervisor(spec)) {
169-
return Response.ok(ImmutableMap.of("id", spec.getId())).build();
169+
return Response.ok(ImmutableMap.of("id", spec.getId(), "restarted", false)).build();
170170
}
171171

172172
manager.createOrUpdateAndStartSupervisor(spec);
@@ -183,7 +183,7 @@ public Response specPost(
183183
.build()
184184
);
185185

186-
return Response.ok(ImmutableMap.of("id", spec.getId())).build();
186+
return Response.ok(ImmutableMap.of("id", spec.getId(), "restarted", true)).build();
187187
}
188188
);
189189
}

indexing-service/src/test/java/org/apache/druid/indexing/overlord/supervisor/SupervisorResourceTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public List<String> getDataSources()
178178
verifyAll();
179179

180180
Assert.assertEquals(200, response.getStatus());
181-
Assert.assertEquals(ImmutableMap.of("id", "my-id"), response.getEntity());
181+
Assert.assertEquals(ImmutableMap.of("id", "my-id", "restarted", true), response.getEntity());
182182
resetAll();
183183

184184
EasyMock.expect(taskMaster.getSupervisorManager()).andReturn(Optional.absent());
@@ -248,7 +248,7 @@ public List<String> getDataSources()
248248
verifyAll();
249249

250250
Assert.assertEquals(200, response.getStatus());
251-
Assert.assertEquals(ImmutableMap.of("id", "my-id"), response.getEntity());
251+
Assert.assertEquals(ImmutableMap.of("id", "my-id", "restarted", false), response.getEntity());
252252

253253
resetAll();
254254

@@ -269,7 +269,7 @@ public List<String> getDataSources()
269269
verifyAll();
270270

271271
Assert.assertEquals(200, response.getStatus());
272-
Assert.assertEquals(ImmutableMap.of("id", "my-id"), response.getEntity());
272+
Assert.assertEquals(ImmutableMap.of("id", "my-id", "restarted", true), response.getEntity());
273273
}
274274

275275
@Test
@@ -300,7 +300,7 @@ public List<String> getDataSources()
300300
verifyAll();
301301

302302
Assert.assertEquals(200, response.getStatus());
303-
Assert.assertEquals(ImmutableMap.of("id", "my-id"), response.getEntity());
303+
Assert.assertEquals(ImmutableMap.of("id", "my-id", "restarted", true), response.getEntity());
304304
resetAll();
305305

306306
EasyMock.expect(taskMaster.getSupervisorManager()).andReturn(Optional.absent());

processing/src/main/java/org/apache/druid/java/util/emitter/service/ServiceMetricEvent.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ public String getHost()
9393
return serviceDims.get(HOST);
9494
}
9595

96+
public Map<String, String> getServiceDims()
97+
{
98+
return serviceDims;
99+
}
100+
96101
public Map<String, Object> getUserDims()
97102
{
98103
return userDims;

processing/src/test/java/org/apache/druid/common/utils/SerializerUtilsTest.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
package org.apache.druid.common.utils;
2121

2222
import org.apache.druid.java.util.common.StringUtils;
23-
import org.junit.After;
24-
import org.junit.Assert;
25-
import org.junit.Before;
26-
import org.junit.Test;
23+
import org.junit.jupiter.api.AfterEach;
24+
import org.junit.jupiter.api.Assertions;
25+
import org.junit.jupiter.api.BeforeEach;
26+
import org.junit.jupiter.api.Test;
2727

2828
import java.io.ByteArrayInputStream;
2929
import java.io.ByteArrayOutputStream;
@@ -47,7 +47,7 @@ public class SerializerUtilsTest
4747
private byte[] longsByte;
4848
private ByteArrayOutputStream outStream;
4949

50-
@Before
50+
@BeforeEach
5151
public void setUpByteArrays() throws IOException
5252
{
5353
ByteArrayOutputStream bos = new ByteArrayOutputStream();
@@ -97,15 +97,15 @@ public void testWriteInts() throws IOException
9797
{
9898
serializerUtils.writeInts(outStream, ints);
9999
byte[] actuals = outStream.toByteArray();
100-
Assert.assertArrayEquals(intsByte, actuals);
100+
Assertions.assertArrayEquals(intsByte, actuals);
101101
}
102102

103103
@Test
104104
public void testWriteFloats() throws IOException
105105
{
106106
serializerUtils.writeFloats(outStream, floats);
107107
byte[] actuals = outStream.toByteArray();
108-
Assert.assertArrayEquals(floatsByte, actuals);
108+
Assertions.assertArrayEquals(floatsByte, actuals);
109109
}
110110

111111
@Test
@@ -120,15 +120,15 @@ public void testChannelWritefloat() throws IOException
120120
}
121121
float expected = serializerUtils.readFloat(inputstream);
122122
float actuals = floats[index];
123-
Assert.assertEquals(expected, actuals, delta);
123+
Assertions.assertEquals(expected, actuals, delta);
124124
}
125125

126126
@Test
127127
public void testWriteLongs() throws IOException
128128
{
129129
serializerUtils.writeLongs(outStream, longs);
130130
byte[] actuals = outStream.toByteArray();
131-
Assert.assertArrayEquals(longsByte, actuals);
131+
Assertions.assertArrayEquals(longsByte, actuals);
132132
}
133133

134134
@Test
@@ -142,7 +142,7 @@ public void testChannelWritelong() throws IOException
142142
inputstream.close();
143143
long expected = serializerUtils.readLong(inputstream);
144144
long actuals = longs[index];
145-
Assert.assertEquals(expected, actuals);
145+
Assertions.assertEquals(expected, actuals);
146146
}
147147

148148
@Test
@@ -151,7 +151,7 @@ public void testReadInts() throws IOException
151151
ByteArrayInputStream inputstream = new ByteArrayInputStream(intsByte);
152152
int[] actuals = serializerUtils.readInts(inputstream);
153153
inputstream.close();
154-
Assert.assertArrayEquals(ints, actuals);
154+
Assertions.assertArrayEquals(ints, actuals);
155155
}
156156

157157
@Test
@@ -160,7 +160,7 @@ public void testReadFloats() throws IOException
160160
ByteArrayInputStream inputstream = new ByteArrayInputStream(floatsByte);
161161
float[] actuals = serializerUtils.readFloats(inputstream);
162162
inputstream.close();
163-
Assert.assertArrayEquals(floats, actuals, delta);
163+
Assertions.assertArrayEquals(floats, actuals, delta);
164164
}
165165

166166
@Test
@@ -169,7 +169,7 @@ public void testReadLongs() throws IOException
169169
ByteArrayInputStream inputstream = new ByteArrayInputStream(longsByte);
170170
long[] actuals = serializerUtils.readLongs(inputstream);
171171
inputstream.close();
172-
Assert.assertArrayEquals(longs, actuals);
172+
Assertions.assertArrayEquals(longs, actuals);
173173
}
174174

175175
@Test
@@ -178,7 +178,7 @@ public void testReadStrings() throws IOException
178178
ByteArrayInputStream inputstream = new ByteArrayInputStream(stringsByte);
179179
String[] actuals = serializerUtils.readStrings(inputstream);
180180
inputstream.close();
181-
Assert.assertArrayEquals(strings, actuals);
181+
Assertions.assertArrayEquals(strings, actuals);
182182
}
183183

184184
@Test
@@ -192,7 +192,7 @@ public void testChannelWriteString() throws IOException
192192
inputstream.close();
193193
String expected = serializerUtils.readString(inputstream);
194194
String actuals = strings[index];
195-
Assert.assertEquals(expected, actuals);
195+
Assertions.assertEquals(expected, actuals);
196196
}
197197

198198
@Test
@@ -202,10 +202,10 @@ public void testByteBufferReadStrings()
202202
buffer.put(stringsByte);
203203
buffer.flip();
204204
String[] actuals = serializerUtils.readStrings(buffer);
205-
Assert.assertArrayEquals(strings, actuals);
205+
Assertions.assertArrayEquals(strings, actuals);
206206
}
207207

208-
@After
208+
@AfterEach
209209
public void tearDown() throws IOException
210210
{
211211
serializerUtils = null;

0 commit comments

Comments
 (0)