Lincoln Stoll 64e535e23b Handle errors when deleting objects from S3
I recently noticed that the cost for ListBucket calls was increasing for an
application that was using Litestream. After investigating it seemed that the
bucket had retained the entire history of data, while Litestream was
continually logging that it was deleting the same data:

```
2022-10-30T12:00:27Z (s3): wal segmented deleted before 0792d3393bf79ced/00000233: n=1428
<snip>
2022-10-30T13:00:24Z (s3): wal segmented deleted before 0792d3393bf79ced/00000233: n=1428
```

This is occuring because the DeleteObjects call is a batch item, that returns
the individual object deletion errors in the response[1]. The S3 replica client
discards the response, and only handles errors in the original API call. I had
a misconfigured IAM policy that meant all deletes were failing, but this never
actually bubbled up as a real error.

To fix this, I added a check for the response body to handle any errors the
operation might have encountered. Because this may include a large number of
errors (in this case 1428 of them), the output is summarized to avoid an overly
large error message. When items are not found, they will not return an error[2]
- they will still be marked as deleted, so this change should be in-line with
the original intentions of this code.

1: https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjects.html#API_DeleteObjects_Example_2
2: https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjects.html
2022-11-03 10:02:42 -06:00
2022-04-17 15:02:32 -06:00
2022-02-08 13:14:49 -07:00
2021-04-21 16:32:05 -06:00
2022-03-05 11:17:42 -07:00
2022-06-07 15:09:52 -06:00
2022-01-04 15:03:59 -07:00
2022-03-05 11:33:34 -07:00
2022-04-14 20:03:52 -06:00
2022-04-17 15:02:32 -06:00
2022-02-19 09:06:49 -07:00
2022-02-19 09:06:49 -07:00
2022-02-06 11:37:06 -07:00
2022-08-08 15:24:46 -06:00
2022-08-08 15:24:46 -06:00
2021-04-21 16:32:05 -06:00
2022-01-11 13:29:20 -07:00
2022-04-14 20:03:52 -06:00
2022-06-23 08:42:37 -06:00
2022-02-06 09:51:04 -07:00
2022-06-07 15:09:52 -06:00
2022-06-23 08:42:37 -06:00
2022-02-19 09:06:49 -07:00

Litestream GitHub release (latest by date) Status GitHub Docker Pulls test

Litestream is a standalone disaster recovery tool for SQLite. It runs as a background process and safely replicates changes incrementally to another file or S3. Litestream only communicates with SQLite through the SQLite API so it will not corrupt your database.

If you need support or have ideas for improving Litestream, please join the Litestream Slack or visit the GitHub Discussions. Please visit the Litestream web site for installation instructions and documentation.

If you find this project interesting, please consider starring the project on GitHub.

Acknowledgements

While the Litestream project does not accept external code patches, many of the most valuable contributions are in the forms of testing, feedback, and documentation. These help harden software and streamline usage for other users.

I want to give special thanks to individuals who invest much of their time and energy into the project to help make it better:

Huge thanks to fly.io for their support and for contributing credits for testing and development!

Contribution Policy

Initially, Litestream was closed to outside contributions. The goal was to reduce burnout by limiting the maintenance overhead of reviewing and validating third-party code. However, this policy is overly broad and has prevented small, easily testable patches from being contributed.

Litestream is now open to code contributions for bug fixes only. Features carry a long-term maintenance burden so they will not be accepted at this time. Please submit an issue if you have a feature you'd like to request.

If you find mistakes in the documentation, please submit a fix to the documentation repository.

Description
Streaming replication for SQLite.
Readme 1.4 MiB
Languages
Go 98.8%
Makefile 0.5%
Python 0.3%
Dockerfile 0.2%
PowerShell 0.1%