FIX: An infinite loop occurs in a hierarchy that contains a circular relationship in SQL Server 2008 R2
Microsoft distributes Microsoft SQL Server 2008 R2 fixes as one downloadable file. Because the fixes are cumulative, each new release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 R2 fix release.
Consider the following scenario:
- You have a Master Data Services (MDS) model and entity that has a domain-based attribute in Microsoft SQL Server 2008 R2. The domain-based attribute is designed to be self-referring to the same attribute.
For example, you have an Employee entity that has a ManagerName attribute. The ManagerName attribute refers to the same Employee entity itself.
Note A manager is also a kind of employee.
- There is a derived hierarchy that is defined on an attribute to display the recursive parent/child relationship for the domain-based attribute.
- You load data values that contain one or more circular references to the MDS staging table. This behavior causes a circular reference, and the first node in the attribute is not part of the circle.
For Example, the following data pattern shows a circular reference. However, the Member1 member value is not part of the circle:Member1 --manager attribute--> Member2 --manager attribute--> Member3 --manager attribute--> Member2 --manager attribute--> Member3
insert into mdm.tblStgMemberAttribute(ModelName, EntityName, MemberType_ID, MemberCode, AttributeName, AttributeValue, Status_ID)Values ('EntityTest', 'ModelTest', 1, 'Member3', 'Manager', 'Member2', 0),('EntityTest', 'ModelTest', 1, 'Member2', 'Manager', 'Member3', 0),('EntityTest', 'ModelTest', 1, 'Member3', 'Manager', 'Member2', 0),('EntityTest', 'ModelTest', 1, 'Member2', 'Manager', 'Member1', 0)('EntityTest', 'ModelTest', 1, 'Member1', 'Manager', 'NULL', 0)
- You use one of the following methods to load data values into the entity by using the MDS staging process:
- Run the Exec [mdm].[udpStagingSweep] procedure by using the necessary parameters to process the staged data.
- Click Integration Management to visit the MDS website home page. On the Import Export page, under the Unbatched Staging Records section header, click the Gear Icon to process the records for a particular model and version.
This issue occurs because the udpStagingSweep and udpStagingMemberAttributeSave procedures call the udpMemberRecursiveCircularCheck procedure one time for each staging row. This behavior should check a domain-based attribute value, and returns an error if the staging row causes a circular reference together with the existing data. After all staging rows are checked, you receive the following results:
- The staging rows without errors are applied.
- The staging rows with errors are noted with an error code.
Cumulative update information
SQL Server 2008 R2 Service Pack 1The fix for this issue was first released in Cumulative Update 4. For more information about how to obtain this cumulative update package for SQL Server 2008 R2 SP1, click the following article number to view the article in the Microsoft Knowledge Base:
2633146 Cumulative Update package 4 for SQL Server 2008 R2 Service Pack 1Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 R2 SP1 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
2567616 The SQL Server 2008 R2 builds that were released after SQL Server 2008 R2 Service Pack 1 was released
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
To work around this issue, use one of the following methods:
- To prevent the issue, follow these steps:
- Manually review the member data values that are being inserted into the staging table before you run the staging process.
- Make sure all member values for any domain-based attributes do not contain circular references that are described in the "Symptoms" section
- When the issue that is described in the "Symptoms" section occurs, follow these steps to correct the issue:
- Identify the session that is running in the infinite loop.
- Kill the session to stop the loop.
- Delete the circular reference values from the staging table before the circular reference is processed again.
- To identify which session to kill, use one of the following methods:
- Use an activity monitor in Microsoft SQL Server Management Studio.
- Select from the sys.sysprocesses or sys.dm_exec_requests dynamic management view (DMV) to identify the sessions that are working inside the MDS database in which the CPU and time are incrementing quickly. Make sure that the current query that is running on the session matches the procedure names that are described in the "Cause" section.
- To identify the currently-running procedure for the sessions, use one of the following methods:
- Right-click Details menu on each process in the activity monitor processes listing.
- Use one of the following parameters:
- The DBCC INPUTBUFFER (spid) command together with the session ID.
- The SELECT * FROM sys.dm_exec_sql_text(sqlhandle) function together with the matching SQL handle parameter when you use the DMV output.
For more information about how to open an activity monitor in SQL Server Management Studio, visit the following MSDN website:KILL syntax, visit the following MSDN website:sys.dm_exec_requests DMV, visit the following MSDN website:sys.dm_exec_sql_text DMV, visit the following MSDN website:DBCC INPUTBUFFER command, visit the following MSDN website:
935897 An Incremental Servicing Model is available from the SQL Server team to deliver hotfixes for reported problemsFor more information about the naming schema for SQL Server updates, click the following article number to view the article in the Microsoft Knowledge Base:
822499 New naming schema for Microsoft SQL Server software update packagesFor more information about software update terminology, click the following article number to view the article in the Microsoft Knowledge Base:
824684 Description of the standard terminology that is used to describe Microsoft software updates
Article ID: 2628712 - Last Review: 12/22/2011 07:02:00 - Revision: 3.0
Microsoft SQL Server 2008 R2 Standard, Microsoft SQL Server 2008 R2 Standard Edition for Small Business, Microsoft SQL Server 2008 R2 Developer, Microsoft SQL Server 2008 R2 Enterprise, Microsoft SQL Server 2008 R2 Web, Microsoft SQL Server 2008 R2 Workgroup