feat: replicate persistent cache task when task needs persistent replicas #3784
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request includes changes to the
scheduler/resource/persistentcache
package to add new functionalities and improve existing ones. The most important changes include adding a new method to load hosts randomly, modifying existing methods to use Redis transactions, and updating data types for task attributes.New functionalities:
scheduler/resource/persistentcache/host_manager.go
: AddedLoadRandom
method to load hosts randomly through the set of Redis. [1] [2]scheduler/resource/persistentcache/peer_manager.go
: AddedLoadPersistentAllByTaskID
method to return all persistent peers by task ID. [1] [2]scheduler/scheduling/scheduling.go
: ImplementedFindReplicatePersistentCacheHosts
to find replicate persistent cache hosts for a task. [1] [2]Improvements to existing methods:
scheduler/resource/persistentcache/host_manager.go
: ModifiedStore
andDelete
methods to use Redis transactions for better consistency. [1] [2]scheduler/resource/persistentcache/peer_manager.go
: UpdatedDelete
method to use Redis transactions.Data type updates:
scheduler/resource/persistentcache/task.go
: Changed data types forPieceLength
,ContentLength
, andTotalPieceCount
fromint32
/int64
touint64
/uint32
. [1] [2]scheduler/resource/persistentcache/task_manager.go
: Updated related methods to reflect the new data types. [1] [2] [3] [4]Related Issue
Motivation and Context
Screenshots (if appropriate)
Types of changes
Checklist