Skip to content

Commit

Permalink
Sync from server repo (0fb6bfad9a1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Spilchen committed Nov 7, 2023
1 parent e463d84 commit cd9d9aa
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 7 deletions.
35 changes: 35 additions & 0 deletions rfc7807/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,39 @@ var (
"Internal error while running Vertica download file",
http.StatusInternalServerError,
)
CreateDirectoryPermissionDenied = newProblemID(
path.Join(errorEndpointsPrefix, "create-directory-permission-denied"),
"Permission denied while creating directories",
http.StatusInternalServerError,
)
CreateDirectoryExistError = newProblemID(
path.Join(errorEndpointsPrefix, "create-directory-exist-error"),
"Directories already exist while creating directories",
http.StatusInternalServerError,
)
CreateDirectoryInvalidPath = newProblemID(
path.Join(errorEndpointsPrefix, "create-directory-invalid-path"),
"Found invalid directory paths while creating directories",
http.StatusBadRequest,
)
CreateDirectoryParentDirectoryExists = newProblemID(
path.Join(errorEndpointsPrefix, "create-directory-parent-directory-exists"),
"Parent directories already exist while creating directories",
http.StatusInternalServerError,
)
CreateDirectoryParentDirectoryNoWritePermission = newProblemID(
path.Join(errorEndpointsPrefix, "create-directory-parent-directory-no-write-permission"),
"No write permission on parent directories while creating directories",
http.StatusInternalServerError,
)
CreateDirectoryNoWritePermission = newProblemID(
path.Join(errorEndpointsPrefix, "create-directory-no-write-permission"),
"No write permission on directories while creating directories",
http.StatusInternalServerError,
)
NonAbsolutePathError = newProblemID(
path.Join(errorEndpointsPrefix, "non-absolute-path-error"),
"Target path is not an absolute path",
http.StatusBadRequest,
)
)
10 changes: 5 additions & 5 deletions vclusterops/nma_stage_vertica_logs_op.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ type NMAStageVerticaLogsOp struct {
hostCatPathMap map[string]string // must correspond to host list exactly!
batch string
logSizeLimitBytes int64
numGZ int // number of archived logs to retrieve
logAgeHours int // The maximum age of archieved logs in hours to retrieve
}

type stageVerticaLogsRequestData struct {
CatalogPath string `json:"catalog_path"`
LogSizeLimitBytes int64 `json:"log_size_limit_bytes"`
NumGZ int `json:"numgz"`
LogAgeHours int `json:"log_age_hours"`
}

type stageVerticaLogsResponseData struct {
Expand All @@ -52,7 +52,7 @@ func makeNMAStageVerticaLogsOp(log vlog.Printer,
hostNodeNameMap map[string]string,
hostCatPathMap map[string]string,
logSizeLimitBytes int64,
numGZ int) (NMAStageVerticaLogsOp, error) {
logAgeHours int) (NMAStageVerticaLogsOp, error) {
nmaStageVerticaLogsOp := NMAStageVerticaLogsOp{}
nmaStageVerticaLogsOp.id = id
nmaStageVerticaLogsOp.hostNodeNameMap = hostNodeNameMap
Expand All @@ -61,7 +61,7 @@ func makeNMAStageVerticaLogsOp(log vlog.Printer,
nmaStageVerticaLogsOp.log = log
nmaStageVerticaLogsOp.hosts = hosts
nmaStageVerticaLogsOp.logSizeLimitBytes = logSizeLimitBytes
nmaStageVerticaLogsOp.numGZ = numGZ
nmaStageVerticaLogsOp.logAgeHours = logAgeHours

// the caller is responsible for making sure hosts and maps match up exactly
err := validateHostMaps(hosts, hostNodeNameMap, hostCatPathMap)
Expand All @@ -75,7 +75,7 @@ func (op *NMAStageVerticaLogsOp) setupRequestBody(hosts []string) error {
stageVerticaLogsData := stageVerticaLogsRequestData{}
stageVerticaLogsData.CatalogPath = op.hostCatPathMap[host]
stageVerticaLogsData.LogSizeLimitBytes = op.logSizeLimitBytes
stageVerticaLogsData.NumGZ = op.numGZ
stageVerticaLogsData.LogAgeHours = op.logAgeHours

dataBytes, err := json.Marshal(stageVerticaLogsData)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions vclusterops/scrutinize.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const VScrutinizeTypeName = "scrutinize"
const scrutinizeURLPrefix = "scrutinize/"

// these could be replaced with options later
const scrutinizeNumGZ = 10 // copy up to 10 archived logs
const scrutinizeLogAgeHours = 24 // copy archived logs produced in recent 24 hours
const scrutinizeLogLimitBytes = 10737418240 // 10GB in bytes

// batches are fixed, top level folders for each node's data
Expand Down Expand Up @@ -227,7 +227,7 @@ func (vcc *VClusterCommands) produceScrutinizeInstructions(options *VScrutinizeO
}

nmaStageVerticaLogsOp, err := makeNMAStageVerticaLogsOp(vcc.Log, options.ID, options.Hosts,
hostNodeNameMap, hostCatPathMap, scrutinizeLogLimitBytes, scrutinizeNumGZ)
hostNodeNameMap, hostCatPathMap, scrutinizeLogLimitBytes, scrutinizeLogAgeHours)
if err != nil {
// map invariant assertion failure -- should not occur
return nil, err
Expand Down

0 comments on commit cd9d9aa

Please sign in to comment.