Browse Source

volume server UI: fix ec volume ui (#7104)

* fix ec volume ui

* Update weed/storage/erasure_coding/ec_volume.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
pull/7109/head
Chris Lu 2 months ago
committed by GitHub
parent
commit
b4d9618efc
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      weed/server/volume_grpc_erasure_coding.go
  2. 11
      weed/server/volume_server_handlers_ui.go
  3. 13
      weed/storage/erasure_coding/ec_volume.go

2
weed/server/volume_grpc_erasure_coding.go

@ -492,7 +492,7 @@ func (vs *VolumeServer) VolumeEcShardsInfo(ctx context.Context, req *volume_serv
for _, shardDetail := range shardDetails { for _, shardDetail := range shardDetails {
ecShardInfo := &volume_server_pb.EcShardInfo{ ecShardInfo := &volume_server_pb.EcShardInfo{
ShardId: uint32(shardDetail.ShardId), ShardId: uint32(shardDetail.ShardId),
Size: shardDetail.Size,
Size: int64(shardDetail.Size),
Collection: v.Collection, Collection: v.Collection,
} }
ecShardInfos = append(ecShardInfos, ecShardInfo) ecShardInfos = append(ecShardInfos, ecShardInfo)

11
weed/server/volume_server_handlers_ui.go

@ -1,12 +1,14 @@
package weed_server package weed_server
import ( import (
"github.com/seaweedfs/seaweedfs/weed/pb"
"github.com/seaweedfs/seaweedfs/weed/util/version"
"net/http" "net/http"
"path/filepath" "path/filepath"
"time" "time"
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/pb"
"github.com/seaweedfs/seaweedfs/weed/util/version"
"github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb" "github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb"
ui "github.com/seaweedfs/seaweedfs/weed/server/volume_server_ui" ui "github.com/seaweedfs/seaweedfs/weed/server/volume_server_ui"
"github.com/seaweedfs/seaweedfs/weed/stats" "github.com/seaweedfs/seaweedfs/weed/stats"
@ -53,5 +55,8 @@ func (vs *VolumeServer) uiStatusHandler(w http.ResponseWriter, r *http.Request)
infos, infos,
serverStats, serverStats,
} }
ui.StatusTpl.Execute(w, args)
if err := ui.StatusTpl.Execute(w, args); err != nil {
glog.Errorf("template execution error: %v", err)
http.Error(w, "Internal server error", http.StatusInternalServerError)
}
} }

13
weed/storage/erasure_coding/ec_volume.go

@ -178,9 +178,11 @@ func (ev *EcVolume) ShardSize() uint64 {
return 0 return 0
} }
func (ev *EcVolume) Size() (size int64) {
func (ev *EcVolume) Size() (size uint64) {
for _, shard := range ev.Shards { for _, shard := range ev.Shards {
size += shard.Size()
if shardSize := shard.Size(); shardSize > 0 {
size += uint64(shardSize)
}
} }
return return
} }
@ -198,16 +200,19 @@ func (ev *EcVolume) ShardIdList() (shardIds []ShardId) {
type ShardInfo struct { type ShardInfo struct {
ShardId ShardId ShardId ShardId
Size int64
Size uint64
} }
func (ev *EcVolume) ShardDetails() (shards []ShardInfo) { func (ev *EcVolume) ShardDetails() (shards []ShardInfo) {
for _, s := range ev.Shards { for _, s := range ev.Shards {
shardSize := s.Size()
if shardSize >= 0 {
shards = append(shards, ShardInfo{ shards = append(shards, ShardInfo{
ShardId: s.ShardId, ShardId: s.ShardId,
Size: s.Size(),
Size: uint64(shardSize),
}) })
} }
}
return return
} }

Loading…
Cancel
Save