Skip to content

Commit

Permalink
Remove servingShards. This is never correct during horizontal reshard…
Browse files Browse the repository at this point in the history
…ing. We can just rely on sourceShards. (bitpoke#133)

Signed-off-by: Peter Farr <Peter@PrismaPhonic.com>
  • Loading branch information
PrismaPhonic authored and enisoc committed Sep 17, 2020
1 parent ac281ca commit 5653c92
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 34 deletions.
4 changes: 0 additions & 4 deletions deploy/crds/planetscale.com_vitesskeyspaces.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -907,10 +907,6 @@ spec:
type: object
resharding:
properties:
servingShards:
items:
type: string
type: array
sourceShards:
items:
type: string
Expand Down
11 changes: 0 additions & 11 deletions docs/api/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1526,17 +1526,6 @@ <h3 id="planetscale.com/v2.ReshardingStatus">ReshardingStatus
</tr>
<tr>
<td>
<code>servingShards</code></br>
<em>
[]string
</em>
</td>
<td>
<p>ServingShards is a list of shards that are currently serving writes.</p>
</td>
</tr>
<tr>
<td>
<code>sourceShards</code></br>
<em>
[]string
Expand Down
2 changes: 0 additions & 2 deletions pkg/apis/planetscale/v2/vitesskeyspace_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,6 @@ type ReshardingStatus struct {
Workflow string `json:"workflow"`
// State is either 'Running', 'Copying', 'Error' or 'Unknown'.
State WorkflowState `json:"state"`
// ServingShards is a list of shards that are currently serving writes.
ServingShards []string `json:"servingShards,omitempty"`
// SourceShards is a list of source shards for the current resharding operation.
SourceShards []string `json:"sourceShards,omitempty"`
// TargetShards is a list of target shards for the current resharding operation.
Expand Down
5 changes: 0 additions & 5 deletions pkg/apis/planetscale/v2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 1 addition & 12 deletions pkg/controller/vitesskeyspace/reconcile_resharding.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"fmt"
"reflect"
"sort"
"strings"

corev1 "k8s.io/api/core/v1"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
Expand Down Expand Up @@ -100,15 +99,7 @@ func (r *reconcileHandler) reconcileResharding(ctx context.Context) (reconcile.R
// At a high level we mostly need to know if we are still in the Copying phase (for any shard whatsoever), or if
// we have an error in resharding somewhere that needs to be surfaced.
var errorMsgs []string
for name, status := range reshardingWorkflow.ShardStatuses {
if status.MasterIsServing {
// The shard status name might have the tablet alias appended to it,
// such as "-80/cell-123". We only want the shard name, so strip
// everything after the first "/" if one is present.
shard := strings.Split(name, "/")[0]

workflowStatus.ServingShards = append(workflowStatus.ServingShards, shard)
}
for _, status := range reshardingWorkflow.ShardStatuses {
for _, vReplRow := range status.MasterReplicationStatuses {
if vReplRow.State == "Error" {
workflowStatus.State = planetscalev2.WorkflowError
Expand Down Expand Up @@ -141,8 +132,6 @@ func (r *reconcileHandler) reconcileResharding(ctx context.Context) (reconcile.R
default:
r.setConditionStatus(planetscalev2.VitessKeyspaceReshardingInSync, corev1.ConditionUnknown, "UnknownWorkflowState", fmt.Sprintf("VReplication workflow %v is in an unknown state.", workflowStatus.Workflow))
}

sort.Strings(workflowStatus.ServingShards)
r.vtk.Status.Resharding = workflowStatus

return resultBuilder.Result()
Expand Down

0 comments on commit 5653c92

Please sign in to comment.