Hi, I'm trying to implement support of mssql 2016 columnstore index feature by myself. I was hoping to modify upgrade actions via UpgradeHandler.OnBeforeExecuteActions, but I can't even reach this method in some cases because of exception.

For example, such code:

internal class Program
    private static void Main(string[] args)
        var dc = new DomainConfiguration("sqlserver", "Data Source=.; Initial Catalog=DO40-Tests; Integrated Security=True;")
            UpgradeMode = DomainUpgradeMode.PerformSafely,



public class ASampleEntity : Entity
    [Field, Key]
    public Guid Id { get; set; }

    public int A { get; set; }

[Index("A", Clustered = true)]
public class SampleEntity : Entity
    [Field, Key]
    public Guid Id { get; set; }

    public int A { get; set; }

    public string B { get; set; }

    public string C { get; set; }

throws this exception:

Unhandled Exception: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection..
Parameter name: dbIndex

Server stack trace:
at Xtensive.Sql.Drivers.SqlServer.v09.ColumnResolver.GetColumn(Int32 dbIndex)
at Xtensive.Sql.Drivers.SqlServer.v09.Extractor.ExtractIndexes()
at Xtensive.Sql.Drivers.SqlServer.v09.Extractor.ExtractCatalogContents()
at Xtensive.Sql.Drivers.SqlServer.v11.Extractor.ExtractCatalogContents()
at Xtensive.Sql.Drivers.SqlServer.v09.Extractor.ExtractSchemes(String catalogName, 
String[] schemaNames)
at Xtensive.Sql.SqlDriver.Extract(SqlConnection connection, IEnumerable`1 tasks)
at Xtensive.Orm.Providers.SqlExecutor.Extract(IEnumerable`1 tasks)
at Xtensive.Orm.Upgrade.SqlWorker.ExtractSchema(UpgradeServiceAccessor services, ISqlExecutor executor)
at Xtensive.Orm.Upgrade.SqlWorker.Run(UpgradeServiceAccessor services, SqlWorkerTask task)
at Xtensive.Orm.Upgrade.SqlWorker.<>c__DisplayClass1.<Create>b__0()
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
at System.Func`1.EndInvoke(IAsyncResult result)
at Xtensive.Core.AsyncFutureResult`1.Get()
at Xtensive.Orm.Upgrade.UpgradingDomainBuilder.CompleteSqlWorker()
at Xtensive.Orm.Upgrade.UpgradingDomainBuilder.BuildMultistageDomain()
at Xtensive.Orm.Upgrade.UpgradingDomainBuilder.Run()
at Xtensive.Orm.Upgrade.UpgradingDomainBuilder.Build(DomainConfiguration configuration)
at Xtensive.Orm.Domain.Build(DomainConfiguration configuration)
at Sample.Program.Main(String[] args) in C:\Projects\CleanDO\Sample\Program.cs:line 23

on database with already set clustered columnstore index on table SampleEntity. But if I remove index from ASampleEntity, or make nonclustered columnstore, or even add two any fields to ASampleEntity, it works!

I hope there is any workaround, because this forsing me to remove index every time i rebuild domain.

DO version - 5.0.13

asked Sep 18 at 05:02

Gushchin%20Anton's gravatar image

Gushchin Anton

One Answer:

Hello Anton,

How exactly do you add a columnstore index? I just manually added it using Management Studio and domain builds normally.

I did following steps:

  1. I turned off clustered PKs, because it is the restriction of RDBMS to have only one clustered index per table.
  2. In recreate mode I built tables structure in database.
  3. Added clustered columnstore index to ASampleEntity table.
  4. Built domain in PerformSafely mode and it went well. The columnstore index wasn't dropped.

Apparently our actions differ, but what is the difference?

answered Sep 19 at 06:03

Alexey%20Kulakov's gravatar image

Alexey Kulakov

On step 3 you should add clustered columnstore index to SampleEntity table, not to ASampleEntity

(Sep 19 at 07:04) Gushchin Anton Gushchin%20Anton's gravatar image

So I should make regular index of SimoleEntity to non-clustered one, right? Because the restriction described in step 1 does not allow me to create one more clustered index.

(Sep 20 at 01:25) Alexey Kulakov Alexey%20Kulakov's gravatar image

Just caught the exception

(Sep 20 at 01:31) Alexey Kulakov Alexey%20Kulakov's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA