Skip to content

Commit

Permalink
remove recovery code to shorten PR
Browse files Browse the repository at this point in the history
  • Loading branch information
davemarco committed Jul 17, 2024
1 parent 1260105 commit e0008d2
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 246 deletions.
3 changes: 0 additions & 3 deletions plugins/out_clp_s3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@ use disk space and have higher memory requirements. The amount of system resourc
proportional to the amount of Fluent Bit tags. With disk store off, the plugin will immediately
process each chunk and send it to S3.

Logs are stored on the disk as IR and Zstd compressed IR. If the plugin were to crash, stored logs
will be sent to S3 when Fluent Bit restarts. The upload index restarts on recovery.

### S3 Objects

Each upload will have a unique key in the following format:
Expand Down
9 changes: 3 additions & 6 deletions plugins/out_clp_s3/flush/flush.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,13 +466,10 @@ func createFile(path string, file string) (*os.File, error) {

fullFilePath := filepath.Join(path, file)

// Try to open the file exclusively. If it already exists something has gone wrong.
f, err := os.OpenFile(fullFilePath, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0o751)
// TODO: Replace os.O_TRUNC with os.O_EXCL once recovery code add in. With recovery on,
// code should throw error if file exists.
f, err := os.OpenFile(fullFilePath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o751)
if err != nil {
// Check if the error is due to the file already existing.
if errors.Is(err, fs.ErrExist) {
return nil, fmt.Errorf("file %s already exists", fullFilePath)
}
return nil, fmt.Errorf("failed to create file %s: %w", fullFilePath, err)
}
return f, nil
Expand Down
11 changes: 0 additions & 11 deletions plugins/out_clp_s3/out_clp_s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (

"github.com/y-scope/fluent-bit-clp/internal/outctx"
"github.com/y-scope/fluent-bit-clp/plugins/out_clp_s3/flush"

Check failure on line 19 in plugins/out_clp_s3/out_clp_s3.go

View workflow job for this annotation

GitHub Actions / go-lint (1.22, ubuntu-latest)

could not import github.com/y-scope/fluent-bit-clp/plugins/out_clp_s3/flush (-: # github.com/y-scope/fluent-bit-clp/plugins/out_clp_s3/flush

Check failure on line 19 in plugins/out_clp_s3/out_clp_s3.go

View workflow job for this annotation

GitHub Actions / go-lint (1.22, macos-latest)

could not import github.com/y-scope/fluent-bit-clp/plugins/out_clp_s3/flush (-: # github.com/y-scope/fluent-bit-clp/plugins/out_clp_s3/flush
"github.com/y-scope/fluent-bit-clp/plugins/out_clp_s3/recovery"
)

const s3PluginName = "out_clp_s3"
Expand Down Expand Up @@ -53,11 +52,6 @@ func FLBPluginInit(plugin unsafe.Pointer) int {

log.Printf("[%s] Init called for id: %s", s3PluginName, outCtx.Config.Id)

err = recovery.FlushStores(outCtx)
if err != nil {
log.Fatalf("Failed to recover logs stored on disk: %s", err)
}

// Set the context for this instance so that params can be retrieved during flush.
output.FLBPluginSetContext(plugin, outCtx)
return output.FLB_OK
Expand Down Expand Up @@ -130,11 +124,6 @@ func FLBPluginExitCtx(ctx unsafe.Pointer) int {

log.Printf("[%s] Exit called for id: %s", s3PluginName, outCtx.Config.Id)

err := recovery.GracefulExit(outCtx)
if err != nil {
log.Printf("Failed to exit gracefully")
}

return output.FLB_OK
}

Expand Down
226 changes: 0 additions & 226 deletions plugins/out_clp_s3/recovery/recovery.go

This file was deleted.

0 comments on commit e0008d2

Please sign in to comment.