Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

Commit

Permalink
Merge branch 'master' into queueDepth
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Bailey committed Feb 7, 2017
2 parents f2e06a9 + 7e3c5f5 commit aa1870f
Show file tree
Hide file tree
Showing 4 changed files with 529 additions and 1 deletion.
24 changes: 24 additions & 0 deletions clients/storehost/client.go
Expand Up @@ -67,3 +67,27 @@ func (s *StoreClientImpl) ReadMessages(req *store.ReadMessagesRequest) (*store.R

return s.client.ReadMessages(ctx, req)
}

// GetAddressFromTimestamp queries store for the address corresponding to the given timestamp
func (s *StoreClientImpl) GetAddressFromTimestamp(req *store.GetAddressFromTimestampRequest) (*store.GetAddressFromTimestampResult_, error) {
ctx, cancel := tcthrift.NewContext(2 * time.Second)
defer cancel()

return s.client.GetAddressFromTimestamp(ctx, req)
}

// SealExtent seals an extent on the specified store
func (s *StoreClientImpl) SealExtent(req *store.SealExtentRequest) error {
ctx, cancel := tcthrift.NewContext(2 * time.Second)
defer cancel()

return s.client.SealExtent(ctx, req)
}

// PurgeMessages seals an extent on the specified store
func (s *StoreClientImpl) PurgeMessages(req *store.PurgeMessagesRequest) (*store.PurgeMessagesResult_, error) {
ctx, cancel := tcthrift.NewContext(2 * time.Second)
defer cancel()

return s.client.PurgeMessages(ctx, req)
}
71 changes: 71 additions & 0 deletions cmd/tools/admin/main.go
Expand Up @@ -628,6 +628,77 @@ func main() {
},
},
},
{
Name: "seal-check",
Aliases: []string{"sc"},
Usage: "seal-check <dest> [--seal]",
Flags: []cli.Flag{
cli.StringFlag{
Name: "prefix, pf",
Value: "/",
Usage: "only process destinations with prefix",
},
cli.BoolFlag{
Name: "seal",
Usage: "seal extents on replica that are not sealed",
},
cli.BoolFlag{
Name: "verbose, v",
Usage: "verbose output",
},
cli.BoolFlag{
Name: "veryverbose, vv",
Usage: "very verbose output",
},
},
Action: func(c *cli.Context) {
admin.SealConsistencyCheck(c)
},
},
{
Name: "store-seal",
Aliases: []string{"seal"},
Usage: "seal <store_uuid> <extent_uuid> [<seqnum>]",
Action: func(c *cli.Context) {
admin.StoreSealExtent(c)
},
},
{
Name: "store-isextentsealed",
Aliases: []string{"issealed"},
Usage: "issealed <store_uuid> <extent_uuid>",
Action: func(c *cli.Context) {
admin.StoreIsExtentSealed(c)
},
},
{
Name: "store-gaft",
Aliases: []string{"gaft"},
Usage: "gaft <store_uuid> <extent_uuid> <timestamp>",
Action: func(c *cli.Context) {
admin.StoreGetAddressFromTimestamp(c)
},
},
{
Name: "store-purgeextent",
Aliases: []string{"purge"},
Usage: "purge <store_uuid> <extent_uuid> [<address> | --entirely]",
Flags: []cli.Flag{
cli.BoolFlag{
Name: "entirely",
Usage: "deletes extent entirely",
},

cli.Int64Flag{
Name: "address, a",
Value: 0,
Usage: "address to delete upto",
},
},
Action: func(c *cli.Context) {
admin.StorePurgeMessages(c)
},
},
}

app.Run(os.Args)
Expand Down
36 changes: 36 additions & 0 deletions tools/admin/lib.go
Expand Up @@ -1123,3 +1123,39 @@ func DeleteServiceConfig(c *cli.Context) {
err = mClient.DeleteServiceConfig(req)
toolscommon.ExitIfError(err)
}

// SealConsistencyCheck iterates through every sealed extent for every destination
// and checks to see if the corresponding replicas have been sealed.
func SealConsistencyCheck(c *cli.Context) {

mClient := toolscommon.GetMClient(c, adminToolService)
toolscommon.SealConsistencyCheck(c, mClient)
}

// StoreSealExtent sends a SealExtent command to the specified store.
func StoreSealExtent(c *cli.Context) {

mClient := toolscommon.GetMClient(c, adminToolService)
toolscommon.StoreSealExtent(c, mClient)
}

// StoreIsExtentSealed checks if an extent is sealed on the specified store
func StoreIsExtentSealed(c *cli.Context) {

mClient := toolscommon.GetMClient(c, adminToolService)
toolscommon.StoreIsExtentSealed(c, mClient)
}

// StoreGetAddressFromTimestamp sends a GetAddressFromTimestamp command to the specified store.
func StoreGetAddressFromTimestamp(c *cli.Context) {

mClient := toolscommon.GetMClient(c, adminToolService)
toolscommon.StoreGetAddressFromTimestamp(c, mClient)
}

// StorePurgeMessages sends a purge command for an extent to the specified store.
func StorePurgeMessages(c *cli.Context) {

mClient := toolscommon.GetMClient(c, adminToolService)
toolscommon.StorePurgeMessages(c, mClient)
}

0 comments on commit aa1870f

Please sign in to comment.