Skip to content

fix buffer write batch dead lock#4577

Merged
envestcc merged 5 commits intomasterfrom
fix_buffer
Apr 1, 2025
Merged

fix buffer write batch dead lock#4577
envestcc merged 5 commits intomasterfrom
fix_buffer

Conversation

@CoderZhi
Copy link
Collaborator

as title.

Fixes #(issue)

Type of change

Please delete options that are not relevant.

  • [] Bug fix (non-breaking change which fixes an issue)
  • [] New feature (non-breaking change which adds functionality)
  • [] Code refactor or improvement
  • [] Breaking change (fix or feature that would cause a new or changed behavior of existing functionality)
  • [] This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • [] make test
  • [] fullsync
  • [] Other test (please specify)

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • [] My code follows the style guidelines of this project
  • [] I have performed a self-review of my code
  • [] I have commented my code, particularly in hard-to-understand areas
  • [] I have made corresponding changes to the documentation
  • [] My changes generate no new warnings
  • [] I have added tests that prove my fix is effective or that my feature works
  • [] New and existing unit tests pass locally with my changes
  • [] Any dependent changes have been merged and published in downstream modules

@CoderZhi CoderZhi requested review from a team, Liuhaai, dustinxie and envestcc as code owners March 11, 2025 08:25
@envestcc envestcc requested a review from Copilot March 11, 2025 12:53
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors batch operations to fix a deadlock issue occurring during buffer write operations. It adds a new Append method to both base and cached batch implementations, updates the corresponding tests and mocks, and modifies the WriteBatch function to leverage the new Append mechanism.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
db/batch/batch_impl.go Introduces Append methods for baseKVStoreBatch and cachedBatch, plus helper functions.
db/batch/batch_impl_test.go Adds tests to validate the new Append functionality.
test/mock/mock_batch/mock_batch.go Updates mock implementations to incorporate the new Append methods.
db/batch/batch.go Updates the KVStoreBatch interface to include the Append method.
db/kvstorewithbuffer.go Refactors WriteBatch to use the new Append method, reducing lock complexity.

CoderZhi and others added 2 commits March 16, 2025 00:43
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@sonarqubecloud
Copy link

@envestcc envestcc merged commit 595372e into master Apr 1, 2025
4 checks passed
@envestcc envestcc deleted the fix_buffer branch April 1, 2025 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants