You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/07/16 21:13:12 UTC

[GitHub] [pulsar] fmiguelez opened a new issue #7564: Schema properties are not updated if schema definition does not change

fmiguelez opened a new issue #7564:
URL: https://github.com/apache/pulsar/issues/7564


   **Describe the bug**
   The only available operation to update properties of a schema (`SchemaInfo`) is to use `createSchema()` method of `PulsarAdmin`. The problem with that is that it will not update the provided properties if schema definition does not change. 
   
   The only way the admin API provides to update the properties associated with an schema is to delete it first and then create it from scratch. This can be dangerous because if schema creation fails aftewards we will be left with an unreadable topic (missing schema) and also different consumers using different schema versions may also face issues (when we delete an schema all versions are deleted).
   
   **To Reproduce**
   ```
   PulsarAdmin client = createClient();
   String topicUri = getTopicUri();
   
   SchemaInfo info = client.schemas().getSchemaInfo(topicUri);
   
   /*
    * We add a new property
    */
   info.getProperties().put("newProp", "newValue");
   
   PostSchemaPayload sp = new PostSchemaPayload();
   sp.setType(info.getType().toString());
   sp.setSchema(info.getSchemaDefinition());
   sp.setProperties(info.getProperties());
   
   /* 
    * This should update schema properties
    */ 
   client.schemas().createSchema(topicUri, sp);
   
   /*
    * This object does not contain "newProp" 
    */
   info = client.schemas().getSchemaInfo(topicUri);
   ```
   
   **Expected behavior**
   Method to create/update schema should update  properties even if schema definition does not change.
   
   **Screenshots**
   
   **Desktop (please complete the following information):**
    - Windows with Docker Desktop
   
   **Additional context**
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] saumitras commented on issue #7564: Schema properties are not updated if schema definition does not change

Posted by GitBox <gi...@apache.org>.
saumitras commented on issue #7564:
URL: https://github.com/apache/pulsar/issues/7564#issuecomment-1006746729


   @sijie I am also getting the same issue with 2.8. If no one is working on this, can I pick this up?
   
   Also I see same [issue](https://github.com/streamnative/pulsar/issues/1242) in streamnative's fork. Should I create a PR on this repo or streamnative's fork?


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] saumitras commented on issue #7564: Schema properties are not updated if schema definition does not change

Posted by GitBox <gi...@apache.org>.
saumitras commented on issue #7564:
URL: https://github.com/apache/pulsar/issues/7564#issuecomment-1006773843


   Looks like [SchemaHash](https://github.com/apache/pulsar/blob/27855f8eac7c926b4da9fda46379b64f8b522e62/pulsar-common/src/main/java/org/apache/pulsar/common/protocol/schema/SchemaHash.java#L34) is not using SchemaInfo's getProperties and hence only updating when change is there in `SchemaInfo::getSchema` or `SchemaInfo::getType`


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org