Skip to content

Ingester block lifetime changes#628

Merged
mdisibio merged 20 commits intografana:masterfrom
mdisibio:ingester-block-lifetime
Apr 9, 2021
Merged

Ingester block lifetime changes#628
mdisibio merged 20 commits intografana:masterfrom
mdisibio:ingester-block-lifetime

Conversation

@mdisibio
Copy link
Copy Markdown
Contributor

@mdisibio mdisibio commented Apr 5, 2021

What this PR does:
This PR redoes some of the block lifecycle on the ingester to improve stability and startup times.

Previously the ingester would convert the WAL into a CompleteBlock which persisted the data on disk but kept the index and bloom filters in memory. After a restart the blocks would have to be recreated from the WALs since memory was lost, which caused both heavy performance hit on startup, but also an inability to query data that had been flushed but no longer in the WAL.

Now the ingester uses a local backend mounted under /wal/blocks. The WAL is flushed to this local backend first, which fully persists the data/index/bloom, etc. Then it is flushed to the remote backend. On restart any existing blocks are simply reloaded and the ingester resumes where it was. The flushed state of a local block is persisted with a timestamp in a dedicated flushed file.

No configuration or hosting changes are needed. The local backend is mounted under /wal/blocks/ by reusing the existing wal storage location, and it also uses the existing block encoding/downsampling/flushing options.

Which issue(s) this PR fixes:
#633

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@mdisibio mdisibio changed the title WIP - Ingester block lifetime changes Ingester block lifetime changes Apr 6, 2021
Copy link
Copy Markdown
Collaborator

@joe-elliott joe-elliott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have some initial thoughts. It makes sense to me to move the "LocalBlock" and related functionality inside the /tempodb/wal package and provide methods for the ingester/instance to use.

Comment thread modules/ingester/flush.go Outdated
Comment thread modules/ingester/flush.go Outdated
Comment thread modules/ingester/ingester.go Outdated
Comment thread tempodb/wal/wal.go
Comment thread modules/ingester/local_block.go Outdated
Comment thread tempodb/tempodb.go
Comment thread tempodb/backend/local/local.go Outdated
Comment thread tempodb/encoding/backend_block.go Outdated
Comment thread tempodb/encoding/backend_block.go Outdated
Comment thread tempodb/encoding/streaming_block.go
@mdisibio mdisibio requested a review from joe-elliott April 7, 2021 18:47
Copy link
Copy Markdown
Collaborator

@joe-elliott joe-elliott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the changes. This is definitely getting closer.

Some mild refactoring comments, but other than that I'm really liking where this is.

Comment thread modules/ingester/instance.go Outdated
Comment thread modules/ingester/ingester.go Outdated
Comment thread tempodb/wal/append_block.go Outdated
Comment thread tempodb/tempodb.go
Comment thread tempodb/tempodb_test.go Outdated
Comment thread tempodb/wal/wal_test.go Outdated
Comment thread tempodb/wal/local_block.go Outdated
Comment thread tempodb/wal/local_block.go Outdated
Comment thread tempodb/encoding/backend_block.go Outdated
@mdisibio mdisibio requested a review from joe-elliott April 8, 2021 21:20
@mdisibio mdisibio merged commit 93c378a into grafana:master Apr 9, 2021
@mdisibio mdisibio deleted the ingester-block-lifetime branch May 27, 2021 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants