mirror of
https://github.com/bitwarden/server
synced 2025-12-26 13:13:24 +00:00
[PM-25138] Reduce db locking when creating default collections (#6308)
* Use single method for default collection creation * Use GenerateComb to create sequential guids * Pre-sort data for SqlBulkCopy * Add SqlBulkCopy options per dbops recommendations
This commit is contained in:
@@ -41,9 +41,12 @@ public static class CoreHelpers
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Generate sequential Guid for Sql Server.
|
||||
/// ref: https://github.com/nhibernate/nhibernate-core/blob/master/src/NHibernate/Id/GuidCombGenerator.cs
|
||||
/// Generate a sequential Guid for Sql Server. This prevents SQL Server index fragmentation by incorporating timestamp
|
||||
/// information for sequential ordering. This should be preferred to <see cref="Guid.NewGuid"/> for any database IDs.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// ref: https://github.com/nhibernate/nhibernate-core/blob/master/src/NHibernate/Id/GuidCombGenerator.cs
|
||||
/// </remarks>
|
||||
/// <returns>A comb Guid.</returns>
|
||||
public static Guid GenerateComb()
|
||||
=> GenerateComb(Guid.NewGuid(), DateTime.UtcNow);
|
||||
|
||||
Reference in New Issue
Block a user