hanahmily opened a new issue, #10956: URL: https://github.com/apache/skywalking/issues/10956
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no similar feature requirement. ### Description To ensure data integrity and consistency in BanyanDB, we must add a revision check for each write request. The revision check should be based on the `mod_revision` field of the resource instead of the `create_revision` field. This will ensure that the server validates the request based on the latest modification state of the resource. Additionally, when the validation fails, the client side should clear the metadata cache and reload the newest resource information to prevent future write request failures. ### Use case To implement this feature, we need to perform the following steps: 1. **Update API to include revision field**: Modify the existing API to add a new `resource_mod_revision` field in the write request payload. This will allow clients to send the revision information with the write request. 2. Title: **Update schema creation and updating API to return mod_revision for metadata cache** ## Background To support the revision check feature in BanyanDB, the client side needs to store the `mod_revision` of a resource in its metadata cache. To achieve this, we need to update the schema creation and updating API to return the `mod_revision` of the affected resource. This will allow the client side to store the latest revision information in the metadata cache and use it for subsequent write requests. ## Proposed Solution To implement this feature, we need to perform the following steps: ### API 1. **Update schema creation API**: Modify the schema creation API to return the `mod_revision` of the newly created resource in the response. This will allow the client side to store the revision information in the metadata cache after creating a new schema. 2. **Update schema updating API**: Modify the schema updating API to return the updated `mod_revision` of the affected resource in the response. This will allow the client side to update the metadata cache with the latest revision information after updating an existing schema. ## Server Side Create a server-side Pull Request (PR) that adds the logic to validate the `resource_mod_revision` field in the incoming write requests. The server should only accept the request if the provided `resource_mod_revision` matches the latest revision of the resource. ## Client Side 1. **Store mod_revision in metadata cache**: Update the client-side logic to store the `mod_revision` value returned by the schema creation, updating, and getting API in the metadata cache. This will ensure that the client side has the latest revision information for future write requests. 2. **Handle cache updates on client-side**: Update the client-side logic to clear the metadata cache and reload the latest resource information when a write request is rejected due to a revision mismatch. This will ensure the client-side cache stays in sync with the server-side state. ## Merging Procedure 1. **Create new Docker image with server-side changes**: Once the server-side PR has been reviewed and tested, create a new Docker image that includes these changes by the CI job. This will facilitate integration testing of the feature with client-side and OAP changes. 2. **Integrate client-side and OAP changes**: With the new Docker image available, merge the client-side, and OAP changes that utilize the updated API and revision checks. Ensure that the feature works as expected during the integration testing. 3. **Merge server-side PR**: After successful integration testing, merge the server-side PR to make the revision check feature available in the main codebase. ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
