@ -25,6 +25,7 @@ import (
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
"github.com/seaweedfs/seaweedfs/weed/pb/master_pb"
"github.com/seaweedfs/seaweedfs/weed/pb/master_pb"
"github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb"
"github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb"
"github.com/seaweedfs/seaweedfs/weed/security"
"github.com/seaweedfs/seaweedfs/weed/storage"
"github.com/seaweedfs/seaweedfs/weed/storage"
"github.com/seaweedfs/seaweedfs/weed/storage/needle"
"github.com/seaweedfs/seaweedfs/weed/storage/needle"
"github.com/seaweedfs/seaweedfs/weed/storage/needle_map"
"github.com/seaweedfs/seaweedfs/weed/storage/needle_map"
@ -39,7 +40,8 @@ func init() {
}
}
const (
const (
readbufferSize = 16
readbufferSize = 16
jwtFilerTokenExpirationSeconds = 300
)
)
type commandVolumeFsck struct {
type commandVolumeFsck struct {
@ -53,6 +55,7 @@ type commandVolumeFsck struct {
forcePurging * bool
forcePurging * bool
findMissingChunksInFiler * bool
findMissingChunksInFiler * bool
verifyNeedle * bool
verifyNeedle * bool
filerSigningKey string
}
}
func ( c * commandVolumeFsck ) Name ( ) string {
func ( c * commandVolumeFsck ) Name ( ) string {
@ -139,6 +142,8 @@ func (c *commandVolumeFsck) Do(args []string, commandEnv *CommandEnv, writer io.
}
}
defer os . RemoveAll ( c . tempFolder )
defer os . RemoveAll ( c . tempFolder )
c . filerSigningKey = util . GetViper ( ) . GetString ( "jwt.filer_signing.key" )
// collect all volume id locations
// collect all volume id locations
dataNodeVolumeIdToVInfo , err := c . collectVolumeIds ( )
dataNodeVolumeIdToVInfo , err := c . collectVolumeIds ( )
if err != nil {
if err != nil {
@ -556,6 +561,12 @@ func (c *commandVolumeFsck) httpDelete(path util.FullPath) {
Host : c . env . option . FilerAddress . ToHttpAddress ( ) ,
Host : c . env . option . FilerAddress . ToHttpAddress ( ) ,
Path : string ( path ) ,
Path : string ( path ) ,
}
}
if c . filerSigningKey != "" {
encodedJwt := security . GenJwtForFilerServer ( security . SigningKey ( c . filerSigningKey ) , jwtFilerTokenExpirationSeconds )
req . Header . Set ( "Authorization" , "BEARER " + string ( encodedJwt ) )
}
if * c . verbose {
if * c . verbose {
fmt . Fprintf ( c . writer , "full HTTP delete request to be sent: %v\n" , req )
fmt . Fprintf ( c . writer , "full HTTP delete request to be sent: %v\n" , req )
}
}