Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(logstream): use beginLLSN in Replicate method #958

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

ijsong
Copy link
Member

@ijsong ijsong commented Jan 16, 2025

What this PR does

This commit replaces llsnList with beginLLSN in the Replicate method. Since
LLSNs in llsnList are strictly sequential, beginLLSN and the length of dataList
are sufficient. The corresponding tests have been updated to reflect this
change. The llsn field in ReplicateRequest has been deprecated and will be
removed soon.

@ijsong ijsong requested a review from hungryjang as a code owner January 16, 2025 05:51
Copy link

codecov bot commented Jan 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.02%. Comparing base (9ee82d7) to head (45a6d6b).

Additional details and impacted files
@@                  Coverage Diff                  @@
##           use_grpc_codec_v2     #958      +/-   ##
=====================================================
- Coverage              80.07%   80.02%   -0.05%     
=====================================================
  Files                    179      179              
  Lines                  21565    21569       +4     
=====================================================
- Hits                   17268    17261       -7     
- Misses                  3512     3517       +5     
- Partials                 785      791       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ijsong ijsong force-pushed the use_grpc_codec_v2 branch from 859ee20 to 620cb18 Compare February 3, 2025 10:58
@ijsong ijsong force-pushed the beginllsn_in_replicate branch from 984faf6 to 793fc5e Compare February 3, 2025 10:58
ijsong added 10 commits February 3, 2025 20:24
- Add tests for StorageNodeMetadataDescriptor and LogStreamReplicaMetadataDescriptor
- Test methods: ToStorageNodeDescriptor, GetLogStream, Head, and Tail
- Ensure proper coverage for edge cases and nil values
- Add comments for SyncPosition.InvalidSyncPosition, SyncPosition.Invalid,
  SyncPosition.LessThan, SyncRange.InvalidSyncRange, and SyncRange.Validate
  methods.
- Add unit tests for SyncRange validation and invalid cases.
- replaced InvalidLogEntry with an empty LogEntry across the codebase
- removed proto/varlogpb/log_entry.go as it contained unused code
- updated related files to reflect these changes
- Removed unused functions from metadata.go
- Added comprehensive unit tests for metadata.go and metadata_test.go
- Improved test coverage for various scenarios
- Added `proto/varlogpb/replica_test.go` to test `EqualReplicas` and
  `ValidReplicas` functions.
- Included various test cases to ensure correct functionality.
- Added new file: proto/varlogpb/storage_node_test.go
- Includes tests for StorageNodeDescriptor validation
- Added unit tests for StoppableListener to cover various scenarios:
  - Valid and invalid addresses
  - Accepting connections after stopping
  - Successful connection acceptance
- Improved test coverage and ensured reliability of the StoppableListener
  implementation.
- Added `pkg/util/testutil/testutil_test.go` for unit testing.
- Removed unused functions from `pkg/util/testutil/testutil.go`.
This PR updates the gRPC codec from v1 to v2, enhancing performance and reducing
memory allocations by utilizing a memory pool for encoded messages.

Refs:
- grpc/grpc-go#7356
- vitessio/vitess#16790
This commit replaces llsnList with beginLLSN in the Replicate method. Since
LLSNs in llsnList are strictly sequential, beginLLSN and the length of dataList
are sufficient. The corresponding tests have been updated to reflect this
change. The llsn field in ReplicateRequest has been deprecated and will be
removed soon.
@ijsong ijsong force-pushed the use_grpc_codec_v2 branch from 620cb18 to 9ee82d7 Compare February 3, 2025 11:24
@ijsong ijsong force-pushed the beginllsn_in_replicate branch from 793fc5e to 45a6d6b Compare February 3, 2025 11:24
@ijsong ijsong force-pushed the use_grpc_codec_v2 branch 2 times, most recently from 101fbbc to e7002e3 Compare February 3, 2025 15:08
Base automatically changed from use_grpc_codec_v2 to main February 3, 2025 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants