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 2021/01/15 18:54:46 UTC

[GitHub] [pulsar] eolivelli commented on a change in pull request #9212: [pulsar-broker] Fix: handle topic loading failure due to broken schema ledger

eolivelli commented on a change in pull request #9212:
URL: https://github.com/apache/pulsar/pull/9212#discussion_r558513358



##########
File path: pulsar-broker/src/test/java/org/apache/pulsar/broker/service/schema/ClientGetSchemaTest.java
##########
@@ -104,4 +113,62 @@ public void testGetSchema(String serviceUrl) throws Exception {
         assertEquals(client.getSchema(topicAvro).join(), Optional.of(Schema.AVRO(MyClass.class).getSchemaInfo()));
     }
 
+    /**
+     * It validates if schema ledger is deleted or non recoverable then it will clean up schema storage for the topic
+     * and make the topic available.
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void testSchemaFailure() throws Exception {
+        final String tenant = PUBLIC_TENANT;
+        final String namespace = "test-namespace-" + randomName(16);
+        final String topicOne = "test-broken-schema-storage";
+        final String fqtnOne = TopicName.get(TopicDomain.persistent.value(), tenant, namespace, topicOne).toString();
+
+        admin.namespaces().createNamespace(tenant + "/" + namespace, Sets.newHashSet("test"));
+
+        // (1) create topic with schema
+        Producer<Schemas.PersonTwo> producer = pulsarClient
+                .newProducer(Schema.AVRO(SchemaDefinition.<Schemas.PersonTwo> builder().withAlwaysAllowNull(false)
+                        .withSupportSchemaVersioning(true).withPojo(Schemas.PersonTwo.class).build()))
+                .topic(fqtnOne).create();
+
+        producer.close();
+
+        String key = TopicName.get(fqtnOne).getSchemaName();
+        BookkeeperSchemaStorage schemaStrogate = (BookkeeperSchemaStorage) pulsar.getSchemaStorage();

Review comment:
       Typo: strogate?




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