Skip to content

Commit

Permalink
Attempt to address a data race issue within identity store
Browse files Browse the repository at this point in the history
 - Testcase TestIdentityStore_LocalAliasInvalidations identified a data race issue.
 - This reverts the previous attempt to address the issue from #13093
  • Loading branch information
stevendpclark committed Dec 20, 2021
1 parent 312fcd9 commit e23bfe2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions vault/identity_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ func (i *IdentityStore) CreateOrFetchEntity(ctx context.Context, alias *logical.
}

// Check if an entity already exists for the given alias
entity, err = i.entityByAliasFactors(alias.MountAccessor, alias.Name, false)
entity, err = i.entityByAliasFactors(alias.MountAccessor, alias.Name, true)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -838,8 +838,7 @@ func (i *IdentityStore) CreateOrFetchEntity(ctx context.Context, alias *logical.
}

txn.Commit()

return entity, nil
return entity.Clone()
}

// changedAliasIndex searches an entity for changed alias metadata.
Expand Down
2 changes: 1 addition & 1 deletion vault/identity_store_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ func (i *IdentityStore) processLocalAlias(ctx context.Context, lAlias *logical.A
return nil, fmt.Errorf("mount accessor %q is not local", lAlias.MountAccessor)
}

alias, err := i.MemDBAliasByFactors(lAlias.MountAccessor, lAlias.Name, true, false)
alias, err := i.MemDBAliasByFactors(lAlias.MountAccessor, lAlias.Name, false, false)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit e23bfe2

Please sign in to comment.