Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [Unreleased]

### Added
- Support for initial placement policy of containers (#381)

### Changed

Expand Down
35 changes: 35 additions & 0 deletions netmap/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,41 @@ message PlacementPolicy {
}
// Erasure coding rules. Limited to 4 items.
repeated ECRule ec_rules = 6 [json_name = "ecRules"];

// Rules applied during initial data placement.
//
// `replica_limits` allows to override `Replica.count` and EC partitions. If
// set, `replica_limits` must have a length equal to the sum of `replicas`
// (`RN`) and `ec_rules` length. Each of first `RN` elements of
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what does RN mean?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

alias to use briefly further

// `replica_limits` must be less than or equal to corresponding
// `Replica.count`. The remaining elements must be either 0 (corresponding
Comment thread
carpawell marked this conversation as resolved.
// EC rule is skipped) or 1 (done). At least one `replica_limits` element
// must be non-zero.
//
// `max_replicas` allows to limit total number of replicas and EC partitions
// for successful operation. If set, `max_replicas` must not overflow total
// replica limit (`replica_limits` or main ones).
//
// `prefer_local` allows to tell server to try to store `MaxReplicas`
// replicas in locations that include this server. `prefer_local` must be set
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

does this line mean it is impossible to use prefer_local with non-empty replica_limits? the issue provides an example that allows it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

no, there is no such restriction in this statement

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hm, that is how i understood it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

well, this paragraph does not contain replica_limits at all. So i did not catch ur thought

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i read it as prefer_local can be used with max_replicas only, so the remaining fields (replica_limits only) should not be used with prefer_local. that would conflict with the example from the issue. if it is not -- no problem

// along with `max_replicas` only.
//
// Either `replica_limits` or `max_replicas` must be specified.
//
// Initial policy must not repeat the main one. In particular, policy with
Comment thread
carpawell marked this conversation as resolved.
// `replica_limits` equal to main ones only is invalid.
message Initial {
// Limits on the number of replicas and EC partitions
repeated uint32 replica_limits = 1 [json_name = "replicaLimits"];

// Maximum total number of replicas
uint32 max_replicas = 2 [json_name = "maxReplicas"];

// Flag to prefer local placement over regular one
bool prefer_local = 3 [json_name = "preferLocal"];
}
// Initial placement rules.
Initial initial = 7 [json_name = "initial"];
}

// NeoFS node description
Expand Down
36 changes: 36 additions & 0 deletions proto-docs/netmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
- [NodeInfo.Attribute](#neo.fs.v2.netmap.NodeInfo.Attribute)
- [PlacementPolicy](#neo.fs.v2.netmap.PlacementPolicy)
- [PlacementPolicy.ECRule](#neo.fs.v2.netmap.PlacementPolicy.ECRule)
- [PlacementPolicy.Initial](#neo.fs.v2.netmap.PlacementPolicy.Initial)
- [Replica](#neo.fs.v2.netmap.Replica)
- [Selector](#neo.fs.v2.netmap.Selector)

Expand Down Expand Up @@ -488,6 +489,7 @@ storage policy definition languages.
| filters | [Filter](#neo.fs.v2.netmap.Filter) | repeated | List of named filters to reference in selectors |
| subnet_id | [neo.fs.v2.refs.SubnetID](#neo.fs.v2.refs.SubnetID) | | DEPRECATED. Was used for subnetwork ID to select nodes from, currently ignored. |
| ec_rules | [PlacementPolicy.ECRule](#neo.fs.v2.netmap.PlacementPolicy.ECRule) | repeated | Erasure coding rules. Limited to 4 items. |
| initial | [PlacementPolicy.Initial](#neo.fs.v2.netmap.PlacementPolicy.Initial) | | Initial placement rules. |


<a name="neo.fs.v2.netmap.PlacementPolicy.ECRule"></a>
Expand Down Expand Up @@ -537,6 +539,40 @@ because they have no payload.
| selector | [string](#string) | | Name of the linked selector |


<a name="neo.fs.v2.netmap.PlacementPolicy.Initial"></a>

### Message PlacementPolicy.Initial
Rules applied during initial data placement.

`replica_limits` allows to override `Replica.count` and EC partitions. If
set, `replica_limits` must have a length equal to the sum of `replicas`
(`RN`) and `ec_rules` length. Each of first `RN` elements of
`replica_limits` must be less than or equal to corresponding
`Replica.count`. The remaining elements must be either 0 (corresponding
EC rule is skipped) or 1 (done). At least one `replica_limits` element
must be non-zero.

`max_replicas` allows to limit total number of replicas and EC partitions
for successful operation. If set, `max_replicas` must not overflow total
replica limit (`replica_limits` or main ones).

`prefer_local` allows to tell server to try to store `MaxReplicas`
replicas in locations that include this server. `prefer_local` must be set
along with `max_replicas` only.

Either `replica_limits` or `max_replicas` must be specified.

Initial policy must not repeat the main one. In particular, policy with
`replica_limits` equal to main ones only is invalid.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| replica_limits | [uint32](#uint32) | repeated | Limits on the number of replicas and EC partitions |
| max_replicas | [uint32](#uint32) | | Maximum total number of replicas |
| prefer_local | [bool](#bool) | | Flag to prefer local placement over regular one |


<a name="neo.fs.v2.netmap.Replica"></a>

### Message Replica
Expand Down