ibessonov commented on a change in pull request #244:
URL: https://github.com/apache/ignite-3/pull/244#discussion_r678316356
##########
File path:
modules/configuration-annotation-processor/src/test/java/org/apache/ignite/internal/configuration/notifications/ConfigurationListenerTest.java
##########
@@ -246,9 +295,66 @@ else if (ctx.newValue().size() == 0) {
log.clear();
configuration.change(parent ->
- parent.changeElements(elements -> elements.delete("name"))
+ parent.changeElements(elements -> elements.rename("name",
"newName"))
+ ).get(1, SECONDS);
+
+ assertEquals(List.of("parent", "elements", "rename"), log);
+
+ log.clear();
+
+ configuration.change(parent ->
+ parent.changeElements(elements -> elements.delete("newName"))
).get(1, SECONDS);
assertEquals(List.of("parent", "elements", "delete"), log);
}
+
+ /** */
+ @Test
+ @Disabled("Will be fixed in
https://issues.apache.org/jira/browse/IGNITE-15193")
+ public void dataRace() throws Exception {
+ configuration.change(parent -> parent.changeElements(elements ->
+ elements.create("name", e -> {}))
+ ).get(1, SECONDS);
+
+ CountDownLatch wait = new CountDownLatch(1);
+ CountDownLatch release = new CountDownLatch(1);
+
+ List<String> log = new CopyOnWriteArrayList<>();
+
+ configuration.listen(ctx -> {
+ try {
+ wait.await();
Review comment:
Done
##########
File path:
modules/configuration-annotation-processor/src/test/java/org/apache/ignite/internal/configuration/notifications/ConfigurationListenerTest.java
##########
@@ -138,7 +144,7 @@ public void childNode() throws Exception {
/** */
@Test
public void namedListNode() throws Exception {
Review comment:
I think I'll split it. EDIT: Done
##########
File path:
modules/configuration-annotation-processor/src/test/java/org/apache/ignite/internal/configuration/notifications/ConfigurationListenerTest.java
##########
@@ -246,9 +295,66 @@ else if (ctx.newValue().size() == 0) {
log.clear();
configuration.change(parent ->
- parent.changeElements(elements -> elements.delete("name"))
+ parent.changeElements(elements -> elements.rename("name",
"newName"))
+ ).get(1, SECONDS);
+
+ assertEquals(List.of("parent", "elements", "rename"), log);
+
+ log.clear();
+
+ configuration.change(parent ->
+ parent.changeElements(elements -> elements.delete("newName"))
).get(1, SECONDS);
assertEquals(List.of("parent", "elements", "delete"), log);
}
+
+ /** */
+ @Test
+ @Disabled("Will be fixed in
https://issues.apache.org/jira/browse/IGNITE-15193")
+ public void dataRace() throws Exception {
+ configuration.change(parent -> parent.changeElements(elements ->
+ elements.create("name", e -> {}))
+ ).get(1, SECONDS);
+
+ CountDownLatch wait = new CountDownLatch(1);
+ CountDownLatch release = new CountDownLatch(1);
+
+ List<String> log = new CopyOnWriteArrayList<>();
+
+ configuration.listen(ctx -> {
+ try {
+ wait.await();
+ }
+ catch (InterruptedException e) {
+ fail(e.getMessage());
+ }
+
+ release.countDown();
+
+ return completedFuture(null);
+ });
+
+ configuration.elements().get("name").listen(ctx -> {
+ assertNull(ctx.newValue());
+
+ log.add("deleted");
+
+ return completedFuture(null);
+ });
+
+ Future<Void> fut = configuration.change(parent ->
parent.changeElements(elements ->
+ elements.delete("name"))
+ );
+
+ wait.countDown();
+
+ configuration.elements();
+
+ release.await();
Review comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]