Support gzip compression for EtcdSnapshot

Abierto
#374 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
aws, go, kubernetes

Línea de trabajo

Start from the agent's snapshot path, where cli.Snapshot() streams to the file or S3 uploader, and from the objectKey/localPath naming, then trace how the Job receives its settings. The restore path needs ensureRestoreSpace to account for uncompressed size and a .gz check before calling etcdutl. Done means a gzip-enabled snapshot round-trips through restore, and status.artifact reports the compressed size and SHA-256. Settle the --skip-hash-check question with maintainers before changing it.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Our etcd database size is already several GB, so it would be nice if EtcdSnapshot can support gzip compression. Every snapshot is uploaded to S3 (and downloaded again when restore), which costs a lot of traffic, and with frequent snapshots and some retention, the .db files also take a lot of space in the bucket.

etcd snapshots compress well. In my test, gzip saves about 85% space, both before and after defrag.

spec:
  compression: gzip  # default: none

I took a quick look at the code. For snapshot, the agent already streams cli.Snapshot() to the file/S3 uploader, so I think we only need to wrap it with a gzip.Writer, change the file name to <name>.db.gz (objectKey / localPath), and pass the setting to the Job.

For restore, the source is already an exact key/path, so no new field is needed. The agent can decompress it when the name ends with .gz, then call etcdutl. ensureRestoreSpace also needs to consider the uncompressed size.

I think status.artifact size/SHA-256 should be for the compressed file, since that is what is actually stored. gzip also has a CRC, so a broken file will fail when decompressing.

by the way,
restore uses --skip-hash-check because the snapshot stream "carries no hash", but actually the server appends a SHA-256 at the end and clientv3 keeps it, so this flag can be removed.
(or do I need to open a new issue for that?)

I'm happy to send a PR if this looks OK.

Lenguaje dominante
Go
Estrellas
154
Forks
31
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

  • Incluye un Dockerfile o un archivo de Docker Compose
  • Sin plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de cozystack/etcd-operator

Todos los issues de cozystack/etcd-operator

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.