-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
index-shipper: add support for multiple stores (#7754)
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](https://github.com/grafana/loki/blob/ff7b46297345b215fbf49c2cd4c364d125b6290b/pkg/storage/factory.go#L188) (from across periods) for a given index type `boltdb-shipper, tsdb`. Since index-shipper only has the object client handle to the store defined by `shared_store_type`, it limits the index uploads to a single store. Setting `shared_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**: - usage of `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 the `object_store` from the latest `period_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** - [X] Reviewed the `CONTRIBUTING.md` guide - [ ] Documentation added - [X] Tests updated - [x] `CHANGELOG.md` updated - [x] Changes that require user attention or interaction to upgrade are documented in `docs/sources/upgrading/_index.md` --------- Signed-off-by: Ashwanth Goli <iamashwanth@gmail.com> Co-authored-by: J Stickler <julie.stickler@grafana.com>
- Loading branch information
1 parent
c4261b1
commit 5cef03d
Showing
34 changed files
with
1,497 additions
and
675 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package cluster | ||
|
||
var ( | ||
boltDBShipperSchemaConfigTemplate = ` | ||
schema_config: | ||
configs: | ||
- from: {{.curPeriodStart}} | ||
store: boltdb-shipper | ||
object_store: filesystem | ||
schema: v11 | ||
index: | ||
prefix: index_ | ||
period: 24h | ||
` | ||
additionalBoltDBShipperSchemaConfigTemplate = ` | ||
schema_config: | ||
configs: | ||
- from: {{.additionalPeriodStart}} | ||
store: boltdb-shipper | ||
object_store: store-1 | ||
schema: v11 | ||
index: | ||
prefix: index_ | ||
period: 24h | ||
` | ||
|
||
tsdbShipperSchemaConfigTemplate = ` | ||
schema_config: | ||
configs: | ||
- from: {{.curPeriodStart}} | ||
store: tsdb | ||
object_store: filesystem | ||
schema: v11 | ||
index: | ||
prefix: index_ | ||
period: 24h | ||
` | ||
additionalTSDBShipperSchemaConfigTemplate = ` | ||
schema_config: | ||
configs: | ||
- from: {{.additionalPeriodStart}} | ||
store: tsdb | ||
object_store: store-1 | ||
schema: v11 | ||
index: | ||
prefix: index_ | ||
period: 24h | ||
` | ||
) | ||
|
||
func WithAdditionalBoltDBPeriod(c *Cluster) { | ||
c.periodCfgs = append(c.periodCfgs, additionalBoltDBShipperSchemaConfigTemplate, boltDBShipperSchemaConfigTemplate) | ||
} | ||
|
||
func WithAdditionalTSDBPeriod(c *Cluster) { | ||
c.periodCfgs = append(c.periodCfgs, additionalTSDBShipperSchemaConfigTemplate, tsdbShipperSchemaConfigTemplate) | ||
} | ||
|
||
func WithBoltDBAndTSDBPeriods(c *Cluster) { | ||
c.periodCfgs = append(c.periodCfgs, additionalBoltDBShipperSchemaConfigTemplate, tsdbShipperSchemaConfigTemplate) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.