New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
index-shipper: add support for multiple stores #7754
Conversation
28c6293
to
1d4792a
Compare
Signed-off-by: Ashwanth Goli <iamashwanth@gmail.com>
./tools/diff_coverage.sh ../loki-target-branch/test_results.txt test_results.txt ingester,distributor,querier,querier/queryrange,iter,storage,chunkenc,logql,loki Change in test coverage per package. Green indicates 0 or positive change, red indicates that test coverage for a package fell. - ingester -0.1%
+ distributor 0%
+ querier 0%
+ querier/queryrange 0%
+ iter 0%
- storage -2.8%
+ chunkenc 0%
+ logql 0%
+ loki 1.2% |
Signed-off-by: Ashwanth Goli <iamashwanth@gmail.com>
a7b32d7
to
054358a
Compare
return nil | ||
} | ||
|
||
func (m *HeadManager) buildLegacyWALs() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets name it a bit better to make it clearer
func (m *HeadManager) buildLegacyWALs() error { | |
func (m *HeadManager) buildTSDBFromLegacyWALs() error { |
return m.buildWALs(parentDir, true) | ||
} | ||
|
||
func (m *HeadManager) buildWALs(dir string, legacy bool) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets name it a bit better to make it clearer
func (m *HeadManager) buildWALs(dir string, legacy bool) error { | |
func (m *HeadManager) buildTSDBFromWALs(dir string, legacy bool) error { |
pkg/storage/stores/tsdb/store.go
Outdated
// we do not need to build store for each schema config since we do not do any schema specific handling yet. | ||
// If we do need to do schema specific handling, it would be a good idea to abstract away the handling since | ||
// running multiple head managers would be complicated and wasteful. | ||
// NewStore creates a new tsdb index ReaderWriter. | ||
var NewStore = func() newStoreFactoryFunc { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newStoreFactoryFunc
was just a hack to make tsdb store instances a singleton. I think we can get rid of it.
Great job Ashwanth! The changes look great to me. I think we can merge the PR once we get to test it in a dev cell and ensure things work as expected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look great and thanks for taking care of all the feedback. Just two minor suggestions, otherwise we are good to merge this.
I'll raise another pr to verify the flush behavior This reverts commit ee7228c.
Signed-off-by: Ashwanth Goli iamashwanth@gmail.com
What this PR does / why we need it:
Currently loki initializes a single instance of index-shipper to handle all the table ranges (from across periods) for a given index type
boltdb-shipper, tsdb
. Since index-shipper only has the object client handle to the store defined byshared_store_type
, it limits the index uploads to a single store. Settingshared_store_type
to a different store at a later point in time would mean losing access to the indexes stored in the previously configured store.With this PR, we initialize a separate index-shipper & table manager for each period if
shared_store_type
is not explicity configured. This offers the flexibility to store index in multiple stores (across providers).Note:
shared_store_type
in this commit text refers to one of these config options depending on the index in use:-boltdb.shipper.shared-store
,-tsdb.shipper.shared-store
shared_store_type
used to default to theobject_store
from the latestperiod_config
if not explicitly configured. This PR removes these defaults in favor of supporting index uploads to multiple stores.Which issue(s) this PR fixes:
Fixes #7276
Special notes for your reviewer:
All the instances of downloads table manager operate on the same cacheDir. But it shouldn't be a problem as the tableRanges do not overlap across periods.
Checklist
CONTRIBUTING.md
guideCHANGELOG.md
updateddocs/sources/upgrading/_index.md