forked from TrueCloudLab/frostfs-node
[#1412] shard: Resolve container is indexed on metabase resync
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
4572fa4874
commit
3da168f8cf
4 changed files with 49 additions and 2 deletions
|
@ -1058,7 +1058,9 @@ func initLocalStorage(ctx context.Context, c *cfg) {
|
|||
|
||||
var shardsAttached int
|
||||
for _, optsWithMeta := range c.shardOpts(ctx) {
|
||||
id, err := ls.AddShard(ctx, append(optsWithMeta.shOpts, shard.WithTombstoneSource(c.createTombstoneSource()))...)
|
||||
id, err := ls.AddShard(ctx, append(optsWithMeta.shOpts,
|
||||
shard.WithTombstoneSource(c.createTombstoneSource()),
|
||||
shard.WithContainerInfoProvider(c.createContainerInfoProvider(ctx)))...)
|
||||
if err != nil {
|
||||
c.log.Error(logs.FrostFSNodeFailedToAttachShardToEngine, zap.Error(err))
|
||||
} else {
|
||||
|
@ -1313,7 +1315,10 @@ func (c *cfg) reloadConfig(ctx context.Context) {
|
|||
|
||||
var rcfg engine.ReConfiguration
|
||||
for _, optsWithID := range c.shardOpts(ctx) {
|
||||
rcfg.AddShard(optsWithID.configID, append(optsWithID.shOpts, shard.WithTombstoneSource(c.createTombstoneSource())))
|
||||
rcfg.AddShard(optsWithID.configID, append(optsWithID.shOpts,
|
||||
shard.WithTombstoneSource(c.createTombstoneSource()),
|
||||
shard.WithContainerInfoProvider(c.createContainerInfoProvider(ctx)),
|
||||
))
|
||||
}
|
||||
|
||||
err = c.cfgObject.cfgLocalStorage.localStorage.Reload(ctx, rcfg)
|
||||
|
@ -1414,6 +1419,20 @@ func (c *cfg) createTombstoneSource() *tombstone.ExpirationChecker {
|
|||
return tombstoneSource
|
||||
}
|
||||
|
||||
func (c *cfg) createContainerInfoProvider(ctx context.Context) container.InfoProvider {
|
||||
return container.NewInfoProvider(func() (container.Source, error) {
|
||||
// threadsafe: called on init or on sighup when morph initialized
|
||||
if c.cfgMorph.client == nil {
|
||||
initMorphComponents(ctx, c)
|
||||
}
|
||||
cc, err := containerClient.NewFromMorph(c.cfgMorph.client, c.cfgContainer.scriptHash, 0, containerClient.TryNotary())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return containerClient.AsContainerSource(cc), nil
|
||||
})
|
||||
}
|
||||
|
||||
func (c *cfg) shutdown() {
|
||||
old := c.swapHealthStatus(control.HealthStatus_SHUTTING_DOWN)
|
||||
if old == control.HealthStatus_SHUTTING_DOWN {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue