- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3.7k
Producer getting producer busy is removing existing producer from list #11804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    
              
                    addisonj
  
              
              approved these changes
              
                  
                    Aug 26, 2021 
                  
              
              
            
            
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
              
                    hangc0276
  
              
              approved these changes
              
                  
                    Aug 27, 2021 
                  
              
              
            
            
              
                    codelipenghui
  
              
              approved these changes
              
                  
                    Aug 27, 2021 
                  
              
              
            
            
              
                    eolivelli
  
              
              approved these changes
              
                  
                    Aug 27, 2021 
                  
              
              
            
            
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
    
  hangc0276 
      pushed a commit
      that referenced
      this pull request
    
      Aug 27, 2021 
    
    
      
  
    
      
    
  
#11804) ### Motivation When a producer is getting error because of ProducerBusy (existing producer with the same name), it will trigger a producer close operation that will eventually lead to the existing producer getting removed from the topic map (even though that producer is still writing on the topic). The problem is the producer close is triggering a removal from the map: pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractTopic.java Line 683 in 43ded59 if (producers.remove(producer.getProducerName(), producer)) { Even though we check for producer equality, the Producer.equals() is only comparing the producer name, so the old instance gets removed from the map. Instead, the equality of producer needs to be based on the connection id (local & remote addresses and unique id), plus the producer id within that connection. * Producer getting producer busy is removing existing producer from list * Fixed test (cherry picked from commit 6aef83f)
    
  BewareMyPower 
      added a commit
        to streamnative/kop
      that referenced
      this pull request
    
      Aug 30, 2021 
    
    
      
  
    
      
    
  
### Motivation apache/pulsar#11804 added the custom implementations of `equals` and `hashCode` methods of `ServiceCnx`, which made KoP's spotbugs check fail with > Medium: io.streamnative.pulsar.handlers.kop.InternalServerCnx doesn't override org.apache.pulsar.broker.service.ServerCnx.equals(Object) [io.streamnative.pulsar.handlers.kop.InternalServerCnx] At InternalServerCnx.java:[line 1] EQ_DOESNT_OVERRIDE_EQUALS ### Modifications This PR adds the overrided `equals` and `hashCode` methods by calling base class' same name methods simply. On the other hand, since the new `equals` and `hashCode` methods are based on `ctx` field and they are called when removing `Producer` from `Topic`, this PR also updates the `ctx` field of `InternalServerCnx`.
      
        
      
      
  
    1 task
  
    
  nicoloboschi 
      pushed a commit
        to datastax/pulsar
      that referenced
      this pull request
    
      Nov 17, 2021 
    
    
      
  
    
      
    
  
apache#11804) When a producer is getting error because of ProducerBusy (existing producer with the same name), it will trigger a producer close operation that will eventually lead to the existing producer getting removed from the topic map (even though that producer is still writing on the topic). The problem is the producer close is triggering a removal from the map: pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractTopic.java Line 683 in 43ded59 if (producers.remove(producer.getProducerName(), producer)) { Even though we check for producer equality, the Producer.equals() is only comparing the producer name, so the old instance gets removed from the map. Instead, the equality of producer needs to be based on the connection id (local & remote addresses and unique id), plus the producer id within that connection. * Producer getting producer busy is removing existing producer from list * Fixed test (cherry picked from commit 6aef83f)
    
  nicoloboschi 
      pushed a commit
        to datastax/pulsar
      that referenced
      this pull request
    
      Nov 17, 2021 
    
    
      
  
    
      
    
  
apache#11804) ### Motivation When a producer is getting error because of ProducerBusy (existing producer with the same name), it will trigger a producer close operation that will eventually lead to the existing producer getting removed from the topic map (even though that producer is still writing on the topic). The problem is the producer close is triggering a removal from the map: pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractTopic.java Line 683 in 43ded59 if (producers.remove(producer.getProducerName(), producer)) { Even though we check for producer equality, the Producer.equals() is only comparing the producer name, so the old instance gets removed from the map. Instead, the equality of producer needs to be based on the connection id (local & remote addresses and unique id), plus the producer id within that connection. * Producer getting producer busy is removing existing producer from list * Fixed test (cherry picked from commit 6aef83f)
  This was referenced Dec 1, 2021 
      
  
  Open
  
    
  codelipenghui 
      pushed a commit
      that referenced
      this pull request
    
      Dec 11, 2021 
    
    
      
  
    
      
    
  
#11804) ### Motivation When a producer is getting error because of ProducerBusy (existing producer with the same name), it will trigger a producer close operation that will eventually lead to the existing producer getting removed from the topic map (even though that producer is still writing on the topic). The problem is the producer close is triggering a removal from the map: pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractTopic.java Line 683 in 43ded59 if (producers.remove(producer.getProducerName(), producer)) { Even though we check for producer equality, the Producer.equals() is only comparing the producer name, so the old instance gets removed from the map. Instead, the equality of producer needs to be based on the connection id (local & remote addresses and unique id), plus the producer id within that connection. * Producer getting producer busy is removing existing producer from list * Fixed test (cherry picked from commit 6aef83f)
    
  bharanic-dev 
      pushed a commit
        to bharanic-dev/pulsar
      that referenced
      this pull request
    
      Mar 18, 2022 
    
    
      
  
    
      
    
  
apache#11804) ### Motivation When a producer is getting error because of ProducerBusy (existing producer with the same name), it will trigger a producer close operation that will eventually lead to the existing producer getting removed from the topic map (even though that producer is still writing on the topic). The problem is the producer close is triggering a removal from the map: pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractTopic.java Line 683 in 43ded59 if (producers.remove(producer.getProducerName(), producer)) { Even though we check for producer equality, the Producer.equals() is only comparing the producer name, so the old instance gets removed from the map. Instead, the equality of producer needs to be based on the connection id (local & remote addresses and unique id), plus the producer id within that connection. * Producer getting producer busy is removing existing producer from list * Fixed test
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      Labels
      
    cherry-picked/branch-2.7
  Archived: 2.7 is end of life 
  
    cherry-picked/branch-2.8
  Archived: 2.8 is end of life 
  
    doc-not-needed
  Your PR changes do not impact docs 
  
    release/2.7.4
  
    release/2.8.1
  
    type/bug
  The PR fixed a bug or issue reported a bug 
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Motivation
When a producer is getting error because of ProducerBusy (existing producer with the same name), it will trigger a producer close operation that will eventually lead to the existing producer getting removed from the topic map (even though that producer is still writing on the topic).
The problem is the producer close is triggering a removal from the map:
pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractTopic.java
Line 683 in 43ded59
Even though we check for producer equality, the
Producer.equals()is only comparing the producer name, so the old instance gets removed from the map.Instead, the equality of producer needs to be based on the connection id (local & remote addresses and unique id), plus the producer id within that connection.