PacktPublishing / Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud

Hands-On Microservices with Spring Boot and Spring Cloud, published by Packt
MIT License
464 stars 406 forks source link

Chapter 18 - Rolling version v2 - what about Create/Delete? #19

Closed ClimberBear closed 3 years ago

ClimberBear commented 3 years ago

This is not a bug.

Either, IMHO, is a missing content in the book.

When you describe the section "Performing zero-downtime deployments" in chapter 18, you miss totally the problematic regarding the StateFul/DML services.

When I have deployed versions v1 and v2, and submit a POST for creation, the both versions read the RabbitMQ message, and try to create the record (one of them will fail with duplicate, but this is not the question).

Is there any alternative (like version partition added to the queue by Istio)?

At least, comment this question, telling us that this is not contemplated.

magnus-larsson commented 3 years ago

Got catch, thanks!

Both versions of a microservice should belong to one and the same Consumer Group, as described in Chapter 7 Developing Reactive Microservices, section Consumer groups. There seems to be a problem with that when using multiple versions. I'll see if I can find some time to look into this.

magnus-larsson commented 3 years ago

Hello again!

Sorry for not being back earlier, but now I got some time to look into this.

I tried to repeat the error you describe by POST'ing a new product composite like:

curl -X POST -k https://minikube.me/product-composite -H 'Content-Type: application/json' --data '{"productId":3,"name":"product name C","weight":300, "recommendations":[
  {"recommendationId":1,"author":"author 1","rate":1,"content":"content 1"},
  {"recommendationId":2,"author":"author 2","rate":2,"content":"content 2"},
  {"recommendationId":3,"author":"author 3","rate":3,"content":"content 3"}
], "reviews":[
  {"reviewId":1,"author":"author 1","subject":"subject 1","content":"content 1"},
  {"reviewId":2,"author":"author 2","subject":"subject 2","content":"content 2"},
  {"reviewId":3,"author":"author 3","subject":"subject 3","content":"content 3"}
]}' -i -H "Authorization: Bearer $ACCESS_TOKEN" 

From what I can see from the logs in the product, recommendation, and review services, only one instance is processing the request and not both as you claim. I did adjust the log levels to be able to see proper logging. In fact, Istio does not affect the async message processing at all, only the synchronous HTTP traffic, so it should not be able to affect the behavior introduced in chapter 7, from my understanding.

Maybe you tried out posting an already existing product composite? In that case, the posting will be retried a number of times until it is moved to its DQL and the retries will for sure be spread over the available versions, but that is as intended.

If you still think your error description is correct, can you supply the commanders you run and related log output? If you used other versions than in the book, please also note that.

Thanks, Magnus.

jmalbarran commented 3 years ago

Thank you very much, Magnus, for testing

I have lost the logs (where I saw the collision with the primary key).

I will try to retry, but, I'm really busy now. I will come back to you (and, yes, I have more recent version of all landscape)

Thank you!

magnus-larsson commented 3 years ago

Since there is no new input since my suggested solution back in May 21, I'll close this issue.

ClimberBear commented 3 years ago

Thank you very much, Magnus

Really I had no time to re-test. But in any case, thank you for your support.

Jose M. Albarrán Socio Director b-Thinking Software Tlfo: +34 616 968 262 e-Mail: @.**@.> LinkedIn: https://es.linkedin.com/in/jmalbarran Also available in Telegram, Signal, Skype (jmalbarran) and Google Hangoutshttps://hangouts.google.com/call/km5oqrxdtlo3lnawe3svlggrnea. I don't use WhatsApp

De: Magnus Larsson @.> Fecha: jueves, 12 de agosto de 2021, 13:50 Para: PacktPublishing/Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud @.> CC: Jose Manuel Albarrán @.>, Author @.> Asunto: Re: [PacktPublishing/Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud] Chapter 18 - Rolling version v2 - what about Create/Delete? (#19)

Since there is no new input since my suggested solution back in May 21, I'll close this issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/PacktPublishing/Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud/issues/19#issuecomment-897575177, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFQBD33JIMAJSSL6RE4PS7TT4OYQLANCNFSM4ZPFJJPA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email.