Nothing happens when updating XML configuration schema?
- Hi guys!
First of all, thanks for helping me out with my previous issues. Mine and my partner's master thesis are at least advancing ;-). However, I seem not to be able to update the warehouse schema with the methods proposed (this thread is connected with my previous one here: http://forums.microsoft.com/MSDN/showpost.aspx?postid=2498960&SiteID=1).
I'm running the Team Foundation Server 2008 VPC available for download from Microsoft, so one would think things should work out smoothly.
I have my XML schema describing a new Fact table and a dimension use, like this:Code Block<WarehouseConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Dimensions />
<Facts>
<Fact>
<Name>Code Metrics</Name>
<Field>
<Name>Maintainability Index</Name>
<Type>int</Type>
<AggregationFunction>Sum</AggregationFunction>
</Field>
<Field>
<Name>Cyclomatic Complexity</Name>
<Type>int</Type>
<AggregationFunction>Sum</AggregationFunction>
</Field>
<Field>
<Name>Depth of Inheritance</Name>
<Type>int</Type>
<AggregationFunction>Sum</AggregationFunction>
</Field>
<Field>
<Name>Class Coupling</Name>
<Type>int</Type>
<AggregationFunction>Sum</AggregationFunction>
</Field>
<Field>
<Name>Lines of Code</Name>
<Type>int</Type>
<AggregationFunction>Sum</AggregationFunction>
</Field>
<DimensionUses>
<DimensionUse>
<FriendlyUseName>Build</FriendlyUseName>
<UseName>Build</UseName>
<DimensionName>Build</DimensionName>
</DimensionUse>
</DimensionUses>
</Fact>
</Facts>
<FactLinks />
</WarehouseConfig>
(Yes, I've tried exluding <Dimensions /> and <FactLinks /> too, no difference). The file is called CodeMetricsSchema.xml and is saved in the same directory as warehouseschema.xml is located (C:\Program Files\Microsoft Visual Studio 2008 Team Foundation Server\Tools\).
I've read in several places that you should install your schema using SetupWarehouse.exe. That is exactly what I'm doing, like this (logged in as TFSSERVICE):
C:\Program Files\Microsoft Visual Studio 2008 Team Foundation Server\Tools>SetupWarehouse -rebuild -v -o -s ORCASBETA2_TFSV -d TfsWarehouse -c CodeMetricsSchema.xml -a ORCASBETA2_TFSV\TFSSERVICE -ra ORCASBETA2_TFSV\TFSREPORT -mturl http://orcasbeta2_tfsv:8080 -l log.txt
SetupWarehouse: Warehouse updated successfully.
As you can see it says that the Warehouse updated successfully. After that, I browse to http://localhost:8080/Warehouse/v1.0/warehousecontroller.asmx where I click on Run --> Invoke, and checks the GetWarehouseStatus on the same page until it says Idle.
But when I open SQL Server Management Studio Express, or tries to use the Team Project cube (or Build perspective) in Microsoft Excel 2007 (using Get External Data --> From Other Sources --> From Analysis Services), I can't seem to find my Code Metrics fact anywhere at all. In Excel, the Perspectives and the single Cube is there, but when I load any of them I do not get any Code Metrics Facts to laborate with. No tables in the TfsWarehouse database has been created at all, even though I've refreshed, rebooted and everything else you can imagine.
If I query TfsWarehouse._Warehouseconfig like this:Code BlockSELECT [ID]
,[Setting]
FROM [TfsWarehouse].[dbo].[_WarehouseConfig]I can see that CubeChangetimeStamp indeed has changed, but ConfigChangeTimeStamp seems to have the same value as before. The ConfigXml field shows no sign of any Code Metrics Fact at all.
What am I doing wrong? Isn't installing the XML schema like I've done above supposed to create the corresponding tables in the TfsWarehouse database? Or do you perhaps have to create them manually? Or should I change my set of parameters to SetupWarehouse.exe ?
I've been sitting all night with this problem, tried all kind of combinations of parameters to SetupWarehouse and other workarounds, but nothing seems to give me my Code Metrics Fact.
Any tip at all would be greatly, and I really do mean greatly, appreciated.
Thanks in advance,
Tommie
Answers
When you run SetupWarehouse -rebuild -<other flags> do you see the Warehouse being dropped? Does the Last Updated Time column in the Work Item table indicate the work items in that table were all added after you run SetupWarehouse.exe? If not then your Warehouse is not being rebuilt. If this is a VPC it may not matter - just loading the original VPC does pretty much the same thing.
Lets work on getting MakeSchemaChanges working first. I assume the TfsWarehouse DB currently does not have anything related to your custom Code Metrics Fact. Comment out the MakeDataChanges method - only Initialize and MakeSchemaChanges have code. Make sure your MakeSchemaChanges code runs - step through it or write out to Debug trace. Do you get any errors? What are they?
All Replies
Instead of putting your schema changes in XML and introducing them via SetupWarehouse I would suggest that you add them via your custom adapter code. This will make it easy for deployment; you only have to drop the adapter on the machine.
To do this you need to make the changes in MakeSchemaChanges(). Use the IDataStore passed to your adapter during Initialize to get the WarehouseConfig. If your Fact doesn't exist: create your new Fact, add your fields to your Fact and your dimension use. Save the Fact in the Config then return SchemaChangesResult.ChangesCompleted.
See http://msdn2.microsoft.com/en-us/library/bb286956(VS.80).aspx for an example of adding a Field to an existing Fact.
In your MakeDataChanges code you may want to change these lines:
m_dataStore.BeginTransaction();
try
{m_dataStore.SaveFactEntry(metricsDataEntry, false);m_dataStore.CommitTransaction();}
catch
{
m_dataStore.RollbackTransaction();
throw new Exception("Error! Couldn't save the fact entry");
}to:
Code Blocktry
{
false);m_dataStore.SaveFactEntry(metricsDataEntry,
m_dataStore.CommitTransaction();
}
catch{
try{
m_dataStore.RollbackTransaction();
}
catch (Exception ex){
// Log exception.}
throw;}
So you rethrow the same exception you catch - and you don't hide the exception if RollbackTransaction also throws.
When you view the ConfigXml after this you should see your new Fact and you should see the fact tables in the Warehouse.- Thank you for your answer.
I've tried the method you mentioned, but I haven't been able to get it to work. First I tried implementing the adapter like this:
http://tomfury.spaces.live.com/blog/cns!F58BF7D0B46F52B9!300.entry (contains my source code I use for the adapter!)
But it failed ang gave me this exception:
http://tomfury.spaces.live.com/blog/cns!F58BF7D0B46F52B9!301.entry
I will adhere your advice about changing the MakeDataChanges() method. If you, or someone else, can find any fault in my code as shown in the first link above (or anything else that I'm doing wrong), I'd appreciate that a lot.
Thanks in advance,
//Tommie There are a couple things I notice in your MakeSchemaChanges method.
* You should first check to see if your Fact already exists before attempting to add it. MakeSchemaChanges can run multiple times (synchronously). You should only return SchemaChangesResult.ChangesComplete if you make changes.
* You should make the same change in MakeSchemaChanges to not hide the exception (code from previous post). After doing this retry your adapters and post the exception text here.
Just a note - you can debug into your code using VS - often this is quite helpful.
- Thank you once again! I did as you advised me to do, and here's the result:
I check if the Fact exists like this in MakeSchemaChanges():
Code Block//Check if the fact exists
Fact myFact = config.GetFact("Code Metrics");
if (myFact != null)
return SchemaChangesResult.NoChanges;
Furthermore, I've changed both my try-catch parts to this according to your recommendation:
Code Blocktry
{
m_dataStore.Add(config);
m_dataStore.CommitTransaction();
}
catch
{
try
{
m_dataStore.RollbackTransaction();
}
catch (Exception ex)
{
m_dataStore.LogEvent(AdapterEventLevel.Error, ex.ToString());
return SchemaChangesResult.NoChanges;
}
throw;
}
Here's the exception I get:
Event Type: Error
Event Source: TFS Warehouse
Event Category: None
Event ID: 3000
Date: 12/8/2007
Time: 7:48:44 AM
User: N/A
Computer: ORCASBETA2_TFSV
Description:
TF53010: The following error has occurred in a Team Foundation component or extension:
Date (UTC): 12/8/2007 3:48:44 PM
Machine: ORCASBETA2_TFSV
Application Domain: /LM/W3SVC/1747463155/Root/Warehouse-4-128416019544302832
Assembly: Microsoft.TeamFoundation.Warehouse, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v2.0.50727
Process Details:
Process Name: w3wp
Process Id: 2972
Thread Id: 1484
Account name: ORCASBETA2_TFSV\TFSSERVICE
Detailed Message: TF51209: A run-time error System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: TF51216: Unrecognized fact name or missing TrackingId: Code Metrics
at Microsoft.TeamFoundation.Warehouse.AdapterDataStore.CreateFactEntry(String factName)
at CodeMetricsAdapter.CMAdapter.MakeDataChanges()
at Microsoft.TeamFoundation.Warehouse.AdapterWrapper.RunTimerAdapter() occurred on adapter CodeMetricsAdapter.CMAdapter.
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
It seems like it is failing already here in MakeDataChanges():
Code Blockpublic DataChangesResult MakeDataChanges()
{
DataChangesResult result = DataChangesResult.NoChanges;
FactEntry metricsDataEntry = m_dataStore.CreateFactEntry("Code Metrics");
I don't really get this, shouldn't this Fact already exist since MakeSchemaChanges() is invoked? I've checked the warehouseschema.xml, and no sign of any Code Metrics fact is to be found anywhere.
Any advice?
Thanks in advance,
//Tommie
UPDATE:
I commented away the content of MakeDataChanges() method and just returned a NoChanges property, and tried running my adapter again. Now I got these two exceptions:
TF53010: The following error has occurred in a Team Foundation component or extension:
Date (UTC): 12/8/2007 4:17:57 PM
Machine: ORCASBETA2_TFSV
Application Domain: /LM/W3SVC/1747463155/Root/Warehouse-11-128416042576020816
Assembly: Microsoft.TeamFoundation.Warehouse, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v2.0.50727
Process Details:
Process Name: w3wp
Process Id: 2972
Thread Id: 1504
Account name: ORCASBETA2_TFSV\TFSSERVICE
Detailed Message: TF51209: A run-time error System.Data.SqlClient.SqlException: Invalid column name 'Team Project'.
Invalid column name 'Team Project'.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Microsoft.TeamFoundation.Warehouse.WarehouseSchemaCreator.SqlExecuteNonQuery(SqlCommand cmd)
at Microsoft.TeamFoundation.Warehouse.WarehouseSchemaCreator.CreatePrc_Fact_X_AddUpdate(SqlConnection cn, SqlTransaction tr)
at Microsoft.TeamFoundation.Warehouse.WarehouseSchemaCreator.CreateStoredProcedures(SqlConnection cn, SqlTransaction tr)
at Microsoft.TeamFoundation.Warehouse.WarehouseSchemaCreator.ProcessNewConfig(WarehouseConfig config)
at Microsoft.TeamFoundation.Warehouse.AdapterDataStore.Add(WarehouseConfig newConfig)
at CodeMetricsAdapter.CMAdapter.MakeSchemaChanges()
at Microsoft.TeamFoundation.Warehouse.AdapterWrapper.MakeSchemaChanges() occurred on adapter CodeMetricsAdapter.CMAdapter.
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
and:
TF53010: The following error has occurred in a Team Foundation component or extension:
Date (UTC): 12/8/2007 4:17:57 PM
Machine: ORCASBETA2_TFSV
Application Domain: /LM/W3SVC/1747463155/Root/Warehouse-11-128416042576020816
Assembly: Microsoft.TeamFoundation.Warehouse, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v2.0.50727
Process Details:
Process Name: w3wp
Process Id: 2972
Thread Id: 1504
Account name: ORCASBETA2_TFSV\TFSSERVICE
Detailed Message: Schema change failed. \r\nConfig:\r\n<?xml version="1.0" encoding="utf-16"?>
<WarehouseConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Facts>
<Fact>
<Name>Code Churn</Name>
<FriendlyName>Code Churn</FriendlyName>
<PerspectiveName>Code Churn</PerspectiveName>
<IncludeCountMeasure>true</IncludeCountMeasure>
.... [some more of warehouseschema.xml but nothing on code metric]...
<SourceField>_Microsoft_V
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
So I guess the Schema change fails, probably because the config.add(...) fails.
What am I doing wrong?
Thanks in advance,
//Tommie Try the following:
Revert everything
Remove your adapter
Revert the schema to the out of box scheam (run SetupWarehouse like you did before but pass in the original WarehouseConfig XML as a parameter instead of CodeMetricsSchema.xml).
Manually process the warehouse.
Verify there are no messages in the event log
Test Schema Changes
Comment out the contents of MakeDataChanges; leave Initialize and MakeSchemaChanges
Put your adapter back
Either enable tracing or fire up the debugger
Tracing: http://localhost:8080/Warehouse/v1.0/tftrace.aspx?All=Verbose
Use something like DbgView to watch the trace messages.
Manually process the Warehouse and ensure your schema changes occur.
- Check ConfigXml for your Fact and verify a table has been created
How are things going? Are you making progress?
- Hi mr. Ericson,
I've been really busy the last couple of days writing the final chapters on my master thesis. I will try your advice at the beginning of next week (although I think I've already tried the method you described - but it will not do any harm to try it again, and be a bit more observant). I'll get back in this thread when I've tried it out - I think I will manage to do it on Monday night.
Thank you so much for taking your time helping me - it is really appreciated a lot.
Best regards,
//Tommie Haag - Hi again,
I tried once again the procdeure you adviced me to do, but no cigar :-(.
I removed the adapter, and reverted the schema changes:
C:\Program Files\Microsoft Visual Studio 2008 Team Foundation Server\Tools>SetupWarehouse -rebuild -v -o -s ORCASBETA2_TFSV -d TfsWarehouse -c warehouseschema.xml -a ORCASBETA2_TFS
V\TFSSERVICE -ra ORCASBETA2_TFSV\TFSREPORT -mturl http://orcasbeta2_tfsv:8080 -l log.txt
SetupWarehouse: Warehouse updated successfully.
C:\Program Files\Microsoft Visual Studio 2008 Team Foundation Server\Tools>
Processed the warehouse by going to http://localhost:8080/Warehouse/v1.0/warehousecontroller.asmx and choosing Run. I got these information (not error) messages in the Event Viewer:
Warehouse controller application stopped.
The application is being shutdown for the following reason: BinDirChangeOrDirectoryRename
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
and
Warehouse controller application started.
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Went to this page you told me about: http://localhost:8080/Warehouse/v1.0/tftrace.aspx?All=Verbose. This gave me just a blank page (I suppose that it is not supposed to show anything special like a confirmation message or anything?).
Launched DbgView and went to the warehousecontroller.asmx page again and chose Run. I still get the same sql error messages in Event Viewer about not finding the 'Team Project' column:
Event Type: Error
Event Source: TFS Warehouse
Event Category: None
Event ID: 3000
Date: 12/20/2007
Time: 2:04:38 AM
User: N/A
Computer: ORCASBETA2_TFSV
Description:
TF53010: The following error has occurred in a Team Foundation component or extension:
Date (UTC): 12/20/2007 10:04:38 AM
Machine: ORCASBETA2_TFSV
Application Domain: /LM/W3SVC/1747463155/Root/Warehouse-7-128426185442245744
Assembly: Microsoft.TeamFoundation.Warehouse, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v2.0.50727
Process Details:
Process Name: w3wp
Process Id: 2596
Thread Id: 1316
Account name: ORCASBETA2_TFSV\TFSSERVICE
Detailed Message: TF51209: A run-time error System.Data.SqlClient.SqlException: Invalid column name 'Team Project'.
Invalid column name 'Team Project'.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Microsoft.TeamFoundation.Warehouse.WarehouseSchemaCreator.SqlExecuteNonQuery(SqlCommand cmd)
at Microsoft.TeamFoundation.Warehouse.WarehouseSchemaCreator.CreatePrc_Fact_X_AddUpdate(SqlConnection cn, SqlTransaction tr)
at Microsoft.TeamFoundation.Warehouse.WarehouseSchemaCreator.CreateStoredProcedures(SqlConnection cn, SqlTransaction tr)
at Microsoft.TeamFoundation.Warehouse.WarehouseSchemaCreator.ProcessNewConfig(WarehouseConfig config)
at Microsoft.TeamFoundation.Warehouse.AdapterDataStore.Add(WarehouseConfig newConfig)
at CodeMetricsAdapter.CMAdapter.MakeSchemaChanges()
at Microsoft.TeamFoundation.Warehouse.AdapterWrapper.MakeSchemaChanges() occurred on adapter CodeMetricsAdapter.CMAdapter.
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
(and I get the other one too) :
TF53010: The following error has occurred in a Team Foundation component or extension:
Date (UTC): 12/20/2007 10:04:38 AM
Machine: ORCASBETA2_TFSV
Application Domain: /LM/W3SVC/1747463155/Root/Warehouse-7-128426185442245744
Assembly: Microsoft.TeamFoundation.Warehouse, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v2.0.50727
Process Details:
Process Name: w3wp
Process Id: 2596
Thread Id: 1316
Account name: ORCASBETA2_TFSV\TFSSERVICE
Detailed Message: Schema change failed. \r\nConfig:\r\n<?xml version="1.0" encoding="utf-16"?>
<WarehouseConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Facts>
<Fact>
[... more xml but nothing on my fact Code Metrics ... ]
This is really annoying since I do not make any SQL query at all asking for any 'Team Project' column. It should work, shouldn't it?
By the way, DebugView didn't really give me any more information (or perhaps you may be able to read something helpful from this log:
00000000 2:04:08 AM [2596] [DW] [Info, PID 2596, TID 284, 10:04:08.744] Application Request Processing Started
00000001 2:04:08 AM [2596] [DW] [Verbose, PID 2596, TID 284, 10:04:08.744] Request authentication type: NTLM
00000002 2:04:09 AM [2596] [DW] [Info, PID 2596, TID 284, 10:04:09.686] Application Request Processing Ended
00000003 2:04:27 AM [2596] [DW] [Info, PID 2596, TID 1316, 10:04:27.882] Application Request Processing Started
00000004 2:04:27 AM [2596] [DW] [Verbose, PID 2596, TID 1316, 10:04:27.882] Request authentication type: NTLM
00000005 2:04:27 AM [2596] [DW] [Info, PID 2596, TID 1316, 10:04:27.992] Application Request Processing Ended
00000006 2:04:34 AM [2596] [DW] [Info, PID 2596, TID 1316, 10:04:34.692] Application Request Processing Started
00000007 2:04:34 AM [2596] [DW] [Verbose, PID 2596, TID 1316, 10:04:34.692] Request authentication type: NTLM
00000008 2:04:35 AM [2596] [DW] [Info, PID 2596, TID 1316, 10:04:35.333] Application Request Processing Ended
00000009 2:04:35 AM [2596] [DW] [Info, PID 2596, TID 1316, 10:04:35.333] ProcessWarehouse entered.
00000010 2:04:35 AM [2596] [DW] [Info, PID 2596, TID 1316, 10:04:35.343] Starting run on Adapter CodeMetricsAdapter.CMAdapter.
00000011 2:04:38 AM [2596] [DW] [Error, PID 2596, TID 1316, 10:04:38.137] Schema change failed. \r\nConfig:\r\n<?xml version="1.0" encoding="utf-16"?>
00000012 2:04:38 AM [2596] <WarehouseConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
00000013 2:04:38 AM [2596] <Facts>
00000014 2:04:38 AM [2596] <Fact>
00000015 2:04:38 AM [2596] <Name>Code Churn</Name>
00000016 2:04:38 AM [2596] <FriendlyName>Code Churn</FriendlyName>
00000017 2:04:38 AM [2596] <PerspectiveName>Code Churn</PerspectiveName>
00000018 2:04:38 AM [2596] <IncludeCountMeasure>true</IncludeCountMeasure>
00000019 2:04:38 AM [2596] <Fields>
00000020 2:04:38 AM [2596] <Field>
00000021 2:04:38 AM [2596] <Name>Lines Added</Name>
00000022 2:04:38 AM [2596] <FriendlyName>Lines Added</FriendlyName>
00000023 2:04:38 AM [2596] <Type>int</Type>
00000024 2:04:38 AM [2596] <Length>0</Length>
00000025 2:04:38 AM [2596] <Visible>true</Visible>
00000026 2:04:38 AM [2596] <AggregationFunction>Sum</AggregationFunction>
00000027 2:04:38 AM [2596] <RelationalOnly>false</RelationalOnly>
..................00000734 2:04:38 AM [2596] <UseName>Changed By</UseName>
00000735 2:04:38 AM [2596] <FriendlyUseName>Changed By</FriendlyUseName>
00000736 2:04:38 AM [2596] <DimensionName>Person</DimensionName>
00000737 2:04:38 AM [2596] <RelationalOnly>false</RelationalOnly>
00000738 2:04:38 AM [2596] </DimensionUse>
00000739 2:04:38 AM [2596] <D
00000740 2:04:38 AM [2596] imensionUse>
00000741 2:04:38 AM [2596] <UseName>Creat
00000742 2:04:38 AM [2596] [DW] [Error, PID 2596, TID 1316, 10:04:38.157] TF51209: A run-time error System.Data.SqlClient.SqlException: Invalid column name 'Team Project'.
00000743 2:04:38 AM [2596] Invalid column name 'Team Project'.
00000744 2:04:38 AM [2596] at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
00000745 2:04:38 AM [2596] at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
00000746 2:04:38 AM [2596] at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
00000747 2:04:38 AM [2596] at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
00000748 2:04:38 AM [2596] at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
00000749 2:04:38 AM [2596] at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
00000750 2:04:38 AM [2596] at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
00000751 2:04:38 AM [2596] at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
00000752 2:04:38 AM [2596] at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
00000753 2:04:38 AM [2596] at Microsoft.TeamFoundation.Warehouse.WarehouseSchemaCreator.SqlExecuteNonQuery(SqlCommand cmd)
00000754 2:04:38 AM [2596] at Microsoft.TeamFoundation.Warehouse.WarehouseSchemaCreator.CreatePrc_Fact_X_AddUpdate(SqlConnection cn, SqlTransaction tr)
00000755 2:04:38 AM [2596] at Microsoft.TeamFoundation.Warehouse.WarehouseSchemaCreator.CreateStoredProcedures(SqlConnection cn, SqlTransaction tr)
00000756 2:04:38 AM [2596] at Microsoft.TeamFoundation.Warehouse.WarehouseSchemaCreator.ProcessNewConfig(WarehouseConfig config)
00000757 2:04:38 AM [2596] at Microsoft.TeamFoundation.Warehouse.AdapterDataStore.Add(WarehouseConfig newConfig)
00000758 2:04:38 AM [2596] at CodeMetricsAdapter.CMAdapter.MakeSchemaChanges()
00000759 2:04:38 AM [2596] at Microsoft.TeamFoundation.Warehouse.AdapterWrapper.MakeSchemaChanges() occurred on adapter CodeMetricsAdapter.CMAdapter.
00000760 2:04:38 AM [2596] [DW] [Info, PID 2596, TID 1316, 10:04:38.157] Skipping data for adapter CodeMetricsAdapter.CMAdapter since it failed to process schema changes
00000761 2:06:21 AM [1656] ReportingServicesService!library!3!12/20/2007-02:06:21:: i INFO: Cleaned 0 batch records, 0 policies, 0 sessions, 0 cache entries, 0 snapshots, 0 chunks, 0 running jobs, 0 persisted streams
00000762 2:15:49 AM [2596] [DW] [Info, PID 2596, TID 1316, 10:15:49.642] Application Request Processing Started
00000763 2:15:49 AM [2596] [DW] [Verbose, PID 2596, TID 1316, 10:15:49.642] Request authentication type: NTLM
00000764 2:15:49 AM [2596] [DW] [Info, PID 2596, TID 1316, 10:15:49.692] Application Request Processing Ended
00000765 2:15:49 AM [2596] [DW] [Info, PID 2596, TID 1316, 10:15:49.692] ProcessWarehouse entered.
00000766 2:15:49 AM [2596] [DW] [Info, PID 2596, TID 436, 10:15:49.692] Application Request Processing Started
00000767 2:15:49 AM [2596] [DW] [Verbose, PID 2596, TID 436, 10:15:49.692] Request authentication type: NTLM
00000768 2:15:49 AM [2596] [DW] [Info, PID 2596, TID 1316, 10:15:49.702] Starting run on Adapter CodeMetricsAdapter.CMAdapter.
00000769 2:15:51 AM [2596] [DW] [Error, PID 2596, TID 1316, 10:15:51.685] Schema change failed. \r\nConfig:\r\n<?xml version="1.0" encoding="utf-16"?>
00000770 2:15:51 AM [2596] <WarehouseConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
00000771 2:15:51 AM [2596] <Facts>
00000772 2:15:51 AM [2596] <Fact>
00000773 2:15:51 AM [2596] <Name>Code Churn</Name>
00000774 2:15:51 AM [2596] <FriendlyName>Code Churn</FriendlyName>
00000775 2:15:51 AM [2596] <PerspectiveName>Code Churn</PerspectiveName>
00000776 2:15:51 AM [2596] <IncludeCountMeasure>true</IncludeCountMeasure>
00000777 2:15:51 AM [2596] <Fields>
00000778 2:15:51 AM [2596] <Field>
00000779 2:15:51 AM [2596] <Name>Lines Added</Name>
00000780 2:15:51 AM [2596] <FriendlyName>Lines Added</FriendlyName>
00000781 2:15:51 AM [2596] <Type>int</Type>
00000782 2:15:51 AM [2596] <Length>0</Length>
00000783 2:15:51 AM [2596] <Visible>true</Visible>
00000784 2:15:51 AM [2596] <AggregationFunction>Sum</AggregationFunction>
00000785 2:15:51 AM [2596] <RelationalOnly>false</RelationalOnly>
00000786 2:15:51 AM [2596] <CalculatedMembers />
.........00001498 2:15:51 AM [2596] imensionUse>
00001499 2:15:51 AM [2596] <UseName>Creat
00001500 2:15:51 AM [2596] [DW] [Error, PID 2596, TID 1316, 10:15:51.695] TF51209: A run-time error System.Data.SqlClient.SqlException: Invalid column name 'Team Project'.
00001501 2:15:51 AM [2596] Invalid column name 'Team Project'.
00001502 2:15:51 AM [2596] at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
00001503 2:15:51 AM [2596] at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
00001504 2:15:51 AM [2596] at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
00001505 2:15:51 AM [2596] at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
00001506 2:15:51 AM [2596] at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
00001507 2:15:51 AM [2596] at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
00001508 2:15:51 AM [2596] at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
00001509 2:15:51 AM [2596] at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
00001510 2:15:51 AM [2596] at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
00001511 2:15:51 AM [2596] at Microsoft.TeamFoundation.Warehouse.WarehouseSchemaCreator.SqlExecuteNonQuery(SqlCommand cmd)
00001512 2:15:51 AM [2596] at Microsoft.TeamFoundation.Warehouse.WarehouseSchemaCreator.CreatePrc_Fact_X_AddUpdate(SqlConnection cn, SqlTransaction tr)
00001513 2:15:51 AM [2596] at Microsoft.TeamFoundation.Warehouse.WarehouseSchemaCreator.CreateStoredProcedures(SqlConnection cn, SqlTransaction tr)
00001514 2:15:51 AM [2596] at Microsoft.TeamFoundation.Warehouse.WarehouseSchemaCreator.ProcessNewConfig(WarehouseConfig config)
00001515 2:15:51 AM [2596] at Microsoft.TeamFoundation.Warehouse.AdapterDataStore.Add(WarehouseConfig newConfig)
00001516 2:15:51 AM [2596] at CodeMetricsAdapter.CMAdapter.MakeSchemaChanges()
00001517 2:15:51 AM [2596] at Microsoft.TeamFoundation.Warehouse.AdapterWrapper.MakeSchemaChanges() occurred on adapter CodeMetricsAdapter.CMAdapter.
00001518 2:15:51 AM [2596] [DW] [Info, PID 2596, TID 1316, 10:15:51.705] Skipping data for adapter CodeMetricsAdapter.CMAdapter since it failed to process schema changes
00001519 2:15:51 AM [2596] [DW] [Info, PID 2596, TID 436, 10:15:51.735] Application Request Processing Ended
00001520 2:16:21 AM [1656] ReportingServicesService!library!3!12/20/2007-02:16:21:: i INFO: Cleaned 0 batch records, 0 policies, 0 sessions, 0 cache entries, 0 snapshots, 0 chunks, 0 running jobs, 0 persisted streams
00001521 2:26:21 AM [1656] ReportingServicesService!library!3!12/20/2007-02:26:21:: i INFO: Cleaned 0 batch records, 0 policies, 0 sessions, 0 cache entries, 0 snapshots, 0 chunks, 0 running jobs, 0 persisted streams
I'm out on advice here :-(. I just want to verify the steps you followed and the results after each step. Is this what you saw?
Revert everything
1. Remove your adapter
Results in this message:
Warehouse controller application stopped.
The application is being shutdown for the following reason: BinDirChangeOrDirectoryRename2. Revert the schema to the out of box scheam (run SetupWarehouse like you did before but pass in the original WarehouseConfig XML as a parameter instead of CodeMetricsSchema.xml).
SetupWarehouse.exe indicates:
SetupWarehouse: Warehouse updated successfully
TfsWarehouse [Work Item] table is empty.
3. Manually process the warehouse.
Results in:
No errors/warnings in eventvwr.
TfsWarehouse [Work Item] table has some work items in it.
Test Schema Changes
1. Comment out the contents of MakeDataChanges; leave Initialize and MakeSchemaChanges then put your adapter back
Results in same message as #1 above.
2. Either enable tracing or fire up the debugger
Tracing: http://localhost:8080/Warehouse/v1.0/tftrace.aspx?All=Verbose
[Returned page is blank - if you DbgView open before requesting this URI then you see a message there]
Use something like DbgView to watch the trace messages.
3. Manually process the Warehouse and ensure your schema changes occur.
- Check ConfigXml for your Fact and verify a table has been created
Result:
Errors related to column 'Team Project' appear.
Your Fact is not in the ConfigXml stored in the TfsWarehouse DB.
If this is correct, and your adapter code has nothing in MakeDataChanges, would you post your MakeSchemaChanges code? If you would not like to post your code, would you be willing to Email it to me?
- I've downloaded the new VPC from Microsoft now and tried the same procedure on that one to see if it worked better. It didn't. To answer your questions;
Revert Everything
1. Yes
2. Yes (but the accounts used now are both TFSSETUP now, and the server name is TFSRTM08 since I'm using the new VPC.)
The Work Item table is NOT empty (got some stuff here; Set up: Set Permissions | Set up: Migration of Source Code | Set up: Migration of Work Items etcetera). 15 items in total.
3. No warnings/errors in event viewer, got the same entries in work items table as in step 2 above.
Test Schema Changes
1. Yes.
2. Yes, same as before.
3. Yes, the same errors as before and my fact is not stored.
So the only thing not being the same in your scenario and mine (as far as I can tell), is that after running SetupWarehouse the Work Item table is not empty.
Here's my code for MakeDataChanges():
Code Blockpublic DataChangesResult MakeDataChanges()
{
DataChangesResult result = DataChangesResult.NoChanges;
FactEntry metricsDataEntry = m_dataStore.CreateFactEntry("Code Metrics");
string connString = "Data Source=TFSRTM08;" +
"Database=CMDB;" +
"Integrated Security=true;";
SqlConnection conn = new SqlConnection(connString);
try
{
conn.Open();
}
catch (Exception e)
{
m_dataStore.LogEvent(AdapterEventLevel.Error, "Could not open CMDB.");
return DataChangesResult.NoChanges;
}
try
{
SqlCommand command = new SqlCommand("HarvestCodeMetrics", conn);
command.CommandType = CommandType.StoredProcedure;
using (SqlDataReader myReader = command.ExecuteReader(System.Data.CommandBehavior.CloseConnection))
{
while (myReader.Read())
{
metricsDataEntry["Maintainability Index"] = myReader.GetInt32(myReader.GetOrdinal("MaintainabilityIndex"));
metricsDataEntry["Cyclomatic Complexity"] = myReader.GetInt32(myReader.GetOrdinal("CyclomaticComplexity"));
metricsDataEntry["Depth of Inheritance"] = myReader.GetInt32(myReader.GetOrdinal("DepthOfInheritance"));
metricsDataEntry["Class Coupling"] = myReader.GetInt32(myReader.GetOrdinal("ClassCoupling"));
metricsDataEntry["Lines of Code"] = myReader.GetInt32(myReader.GetOrdinal("LinesOfCode"));
metricsDataEntry["Build"] = myReader.GetString(myReader.GetOrdinal("Build"));
}
myReader.Close();
}
}
catch (Exception e)
{
m_dataStore.LogEvent(AdapterEventLevel.Error, "Could not read from CMDB");
return DataChangesResult.NoChanges;
}
//Check if adapter is requested to stop
if (m_stopRequested)
{
return DataChangesResult.StopRequested;
}
// Not requested to stop? Great, start the transaction then.
m_dataStore.BeginTransaction();
try
{
m_dataStore.SaveFactEntry(metricsDataEntry, false);
m_dataStore.CommitTransaction();
}
catch
{
try
{
m_dataStore.RollbackTransaction();
}
catch (Exception ex)
{
m_dataStore.LogEvent(AdapterEventLevel.Error, ex.ToString());
return DataChangesResult.NoChanges;
}
throw;
}
//we're done, mark that we've done some changes.
result = DataChangesResult.ChangesComplete;
m_dataStore.LogEvent(AdapterEventLevel.Informational, "Updated warehouse");
return result;
}
If you do find any solution to this problem, I'd be grateful beyond limits! Thanks once again for taking your time helping me!
Best regards,
//Tommie When you run SetupWarehouse -rebuild -<other flags> do you see the Warehouse being dropped? Does the Last Updated Time column in the Work Item table indicate the work items in that table were all added after you run SetupWarehouse.exe? If not then your Warehouse is not being rebuilt. If this is a VPC it may not matter - just loading the original VPC does pretty much the same thing.
Lets work on getting MakeSchemaChanges working first. I assume the TfsWarehouse DB currently does not have anything related to your custom Code Metrics Fact. Comment out the MakeDataChanges method - only Initialize and MakeSchemaChanges have code. Make sure your MakeSchemaChanges code runs - step through it or write out to Debug trace. Do you get any errors? What are they?
I have a custom warehouse adapter, which I successfully use to create dimensions.
However, when I try to create a Fact, it throws the following error:
TF51209: A run-time error System.Exception: Invalid column name 'Team Project'.
There no column 'Team Project' anywhere in the dimensions and fact properties that I'm using. Anyone knows why the system throws such an error?
I've seen another, older post upon that subject, but no solution.
Event Type: Error
Event Source: TFS Warehouse
Event Category: None
Event ID: 3000
Date: 6/2/2008
Time: 1:39:01 PM
User: N/A
Computer: TFSRTM
Description:
TF53010: The following error has occurred in a Team Foundation component or extension:
Date (UTC): 6/2/2008 5:39:01 PM
Machine: TFSRTM
Application Domain: /LM/W3SVC/2/Root/Warehouse-9-128569019209366144
Assembly: Microsoft.TeamFoundation.Warehouse, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v2.0.50727
Process Details:
Process Name: w3wp
Process Id: 3688
Thread Id: 2832Detailed Message: TF51209: A run-time error System.Exception: Invalid column name 'Team Project'.
Invalid column name 'Team Project'.


