You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "Denovo1998 (via GitHub)" <gi...@apache.org> on 2023/05/27 06:15:31 UTC

[GitHub] [pulsar] Denovo1998 opened a new pull request, #20415: [improve][broker] Supplement schema ledger if schema ledger is lost

Denovo1998 opened a new pull request, #20415:
URL: https://github.com/apache/pulsar/pull/20415

   <!--
   ### Contribution Checklist
     
     - PR title format should be *[type][component] summary*. For details, see *[Guideline - Pulsar PR Naming Convention](https://pulsar.apache.org/contribute/develop-semantic-title/)*. 
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
     
     - Each pull request should address only one issue, not mix up code from multiple issues.
     
     - Each commit in the pull request has a meaningful commit message
   
     - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
   -->
   
   <!-- Either this PR fixes an issue, -->
   
   Fixes #20414
   
   <!-- or this PR is one task of an issue -->
   
   Master Issue: #https://github.com/apache/pulsar/issues/20414
   
   <!-- Details of when a PIP is required and how the PIP process work, please see: https://github.com/apache/pulsar/blob/master/wiki/proposals/PIP.md -->
   
   ### Motivation
   
   https://github.com/apache/pulsar/issues/17221 describes an environment when multiple bookie copies are corrupted, or a Ledger has been deleted. The loss of schema ledger results in new producers and consumers not even being created and working properly.
   
   So we need a solution that does not just skip the schema with the missing ledger, but actually supplements the broken schema ledger.
   
   ### Modifications
   
   <!-- Describe the modifications you've done. -->
   Add a new method `tryCompleteTheLostSchema()` in `SchemaStorage` and `SchemaRegistry`
   ```java
   CompletableFuture<Long> tryCompleteTheLostSchemaLedger(String key, SchemaVersion version, SchemaData schema);
   ```
   1. get schemalocator from metastore
   2. Create a new ledger. And write `SchemaStorageFormat.SchemaEntry` built with `schemaData` and `schemaVersion`.
   3. update schemalocator to metastore(new ledger id)
   
   
   ### Verifying this change
   
   - [x] Make sure that the change passes the CI checks.
   
   *(Please pick either of the following options)*
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   *(or)*
   
   This change is already covered by existing tests, such as *(please describe tests)*.
   
   *(or)*
   
   This change added tests and can be verified as follows:
   
   *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads (10MB)*
     - *Extended integration test for recovery after broker failure*
   
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository: <!-- ENTER URL HERE -->
   
   <!--
   After opening this PR, the build in apache/pulsar will fail and instructions will
   be provided for opening a PR in the PR author's forked repository.
   
   apache/pulsar pull requests should be first tested in your own fork since the 
   apache/pulsar CI based on GitHub Actions has constrained resources and quota.
   GitHub Actions provides separate quota for pull requests that are executed in 
   a forked repository.
   
   The tests will be run in the forked repository until all PR review comments have
   been handled, the tests pass and the PR is approved by a reviewer.
   -->
   


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


Re: [PR] [improve][broker] Supplement schema ledger if schema ledger is lost [pulsar]

Posted by "merlimat (via GitHub)" <gi...@apache.org>.
merlimat commented on PR #20415:
URL: https://github.com/apache/pulsar/pull/20415#issuecomment-6355540249

   Thanks @Denovo1998, and sorry this sat so long. Since this PR, master handles a lost schema ledger without blocking the topic: `NoSuchLedgerExists`/`NoSuchEntry` are non-recoverable and the broken schema is cleaned up, and PIP-327 added `schemaLedgerForceRecovery` for the remaining cases. Keeping the history after a repair is still a fair goal. But the way it's done here (magic props on the upload API that skip compatibility checks, no hash check, and a new abstract method on `SchemaStorage`) could silently change an existing schema version, and it would need a near-complete rewrite after the LightProto migration. I'm closing this as part of the backlog triage. If you'd like to continue, a short PIP for an admin-only "repair schema version" operation that checks the stored hash and runs the compatibility check would be the best next step.


-- 
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] github-actions[bot] commented on pull request #20415: [improve][broker] Supplement schema ledger if schema ledger is lost

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #20415:
URL: https://github.com/apache/pulsar/pull/20415#issuecomment-1656994166

   The pr had no activity for 30 days, mark with Stale label.


-- 
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] Denovo1998 commented on pull request #20415: [improve][broker] Supplement schema ledger if schema ledger is lost

Posted by "Denovo1998 (via GitHub)" <gi...@apache.org>.
Denovo1998 commented on PR #20415:
URL: https://github.com/apache/pulsar/pull/20415#issuecomment-1697455666

   Waiting to discuss whether this plan is feasible. I will send an email to discuss it later.


-- 
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] Denovo1998 commented on pull request #20415: [improve][broker] Supplement schema ledger if schema ledger is lost

Posted by "Denovo1998 (via GitHub)" <gi...@apache.org>.
Denovo1998 commented on PR #20415:
URL: https://github.com/apache/pulsar/pull/20415#issuecomment-1576086363

   @poorbarcode @congbobo184 @codelipenghui 
   `SchemaData` and `SchemaVersion` has moved to the `org.apache.pulsar.broker.service.AbstractTopic`, rather than save in each producer and consumer. Check out the solution in issue #20414. Is this way okay now?


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


Re: [PR] [improve][broker] Supplement schema ledger if schema ledger is lost [pulsar]

Posted by "Denovo1998 (via GitHub)" <gi...@apache.org>.
Denovo1998 commented on PR #20415:
URL: https://github.com/apache/pulsar/pull/20415#issuecomment-1879610755

   In the alternative, the implementation is updated. Needs to be discussed.


-- 
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] lifepuzzlefun commented on a diff in pull request #20415: [improve][broker] Supplement schema ledger if schema ledger is lost

Posted by "lifepuzzlefun (via GitHub)" <gi...@apache.org>.
lifepuzzlefun commented on code in PR #20415:
URL: https://github.com/apache/pulsar/pull/20415#discussion_r1208118062


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractTopic.java:
##########
@@ -697,6 +697,31 @@ public CompletableFuture<Void> checkSchemaCompatibleForConsumer(SchemaData schem
                 .checkConsumerCompatibility(id, schema, getSchemaCompatibilityStrategy());
     }
 
+    protected CompletableFuture<Void> tryCompleteTheLostSchema(SchemaVersion schemaVersion, SchemaData schema) {
+        String id = getSchemaId();
+        return brokerService.pulsar()
+                .getSchemaRegistryService()
+                .tryCompleteTheLostSchema(id, schemaVersion, schema);
+    }
+
+    @Override
+    public CompletableFuture<Long> findSchemaVersion(SchemaData schema) {
+        String id = getSchemaId();
+        return brokerService.pulsar()
+                .getSchemaRegistryService()
+                .findSchemaVersion(id, schema);
+    }
+
+    protected CompletableFuture<SchemaVersion> getLatestSchemaVersion() {
+        return brokerService.pulsar()
+                .getSchemaRegistryService()
+                .getLatestSchemaVersion(getSchemaId())
+                .thenApply(schemaVersion -> {
+                    log.warn("~~~~~~~~~~~~~~~~~~~~~~" + schemaVersion);

Review Comment:
   need remove this debug log



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


Re: [PR] [improve][broker] Supplement schema ledger if schema ledger is lost [pulsar]

Posted by "merlimat (via GitHub)" <gi...@apache.org>.
merlimat closed pull request #20415: [improve][broker] Supplement schema ledger if schema ledger is lost
URL: https://github.com/apache/pulsar/pull/20415


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


Re: [PR] [improve][broker] Supplement schema ledger if schema ledger is lost [pulsar]

Posted by "Denovo1998 (via GitHub)" <gi...@apache.org>.
Denovo1998 commented on PR #20415:
URL: https://github.com/apache/pulsar/pull/20415#issuecomment-2058079142

   Compared with https://github.com/apache/pulsar/pull/18010, there is no configuration control. The default behavior is to automatically skip when the integrity of the schema is destroyed.
   
   Even after this error occurs, whether to skip or not, there should be a configuration that allows users to configure whether to skip or manually repair when the integrity of the schema is damaged.
   
   Of course, the function of manually repairing lost schema does not exist at present. However, I have a pr trying to repair the missing schema.(https://github.com/apache/pulsar/pull/20415) In the future, I will send an email to discuss how to deal with this lost schema.
   
   The current processing of pr does not seem to be a good way.


-- 
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] github-actions[bot] commented on pull request #20415: [improve][broker] Supplement schema ledger if schema ledger is lost

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #20415:
URL: https://github.com/apache/pulsar/pull/20415#issuecomment-1740206736

   The pr had no activity for 30 days, mark with Stale label.


-- 
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] lifepuzzlefun commented on a diff in pull request #20415: [improve][broker] Supplement schema ledger if schema ledger is lost

Posted by "lifepuzzlefun (via GitHub)" <gi...@apache.org>.
lifepuzzlefun commented on code in PR #20415:
URL: https://github.com/apache/pulsar/pull/20415#discussion_r1208118062


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractTopic.java:
##########
@@ -697,6 +697,31 @@ public CompletableFuture<Void> checkSchemaCompatibleForConsumer(SchemaData schem
                 .checkConsumerCompatibility(id, schema, getSchemaCompatibilityStrategy());
     }
 
+    protected CompletableFuture<Void> tryCompleteTheLostSchema(SchemaVersion schemaVersion, SchemaData schema) {
+        String id = getSchemaId();
+        return brokerService.pulsar()
+                .getSchemaRegistryService()
+                .tryCompleteTheLostSchema(id, schemaVersion, schema);
+    }
+
+    @Override
+    public CompletableFuture<Long> findSchemaVersion(SchemaData schema) {
+        String id = getSchemaId();
+        return brokerService.pulsar()
+                .getSchemaRegistryService()
+                .findSchemaVersion(id, schema);
+    }
+
+    protected CompletableFuture<SchemaVersion> getLatestSchemaVersion() {
+        return brokerService.pulsar()
+                .getSchemaRegistryService()
+                .getLatestSchemaVersion(getSchemaId())
+                .thenApply(schemaVersion -> {
+                    log.warn("~~~~~~~~~~~~~~~~~~~~~~" + schemaVersion);

Review Comment:
   need remove this debug log



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