GoEddie / DeploymentContributorFilterer

MIT License
73 stars 35 forks source link

Column Store Indexes erroneously filtered #44

Closed tpressleyhlr closed 1 week ago

tpressleyhlr commented 2 weeks ago

We're seeing an issue where our column store indexes in the [dbo] schema are being filtered erroneously.

Our scehma filter is defined like this: SqlPackageFilter=IgnoreSchema(^((?!\b(dbo|abc|xyz)\b).)*$)

It correctly filters out all objects that are not in the [dbo], [abc], or [xyz] scehmas. However, it also filters our column store indexes from all schemas. The messages we receive look like this:

"Step removed from deployment by SqlPackageFilter, object: [dbo].[TableName].[CIDX_ColumnStoreIndexName], step type: Create" "Step removed from deployment by SqlPackageFilter, object: [xyz].[TableName2].[CIDX_ColumnStoreIndexName2], step type: Create"

Our column store indexes are added as part of the t-sql file defining the table, as shown below:

CREATE TABLE [dbo].[TableName] (
    [IdentityColumn]      BIGINT       IDENTITY (1, 1) NOT NULL,
    [ForeignKeyColumn] UNIQUEIDENTIFIER NULL,
    [TableInfoColumn]     NVARCHAR (40) NULL,
    [DataCodeColumn]    INT
);
GO

CREATE CLUSTERED COLUMNSTORE INDEX [CIDX_ColumnStoreIndexName] ON [dbo].[TableName] WITH (DROP_EXISTING = OFF, COMPRESSION_DELAY = 0);
GO

We are using /p:DropObjectsInSource=False, and we have tested with various combinations of IncludeSchema and KeepType/KeepSchema to try to ensure that we are not doing something incorrectly on our end.

We are not seeing this issue with any other types of objects, keys, indexes, etc.

t-johnson commented 2 weeks ago

hi @tpressleyhlr can you confirm what version of DacFx you are using?

tpressleyhlr commented 1 week ago

We're using version 162.2.111.2 @t-johnson

t-johnson commented 1 week ago

@tpressleyhlr Can you explain the regex? I'm having a hard time understanding what the intent is. Did you try with a simpler regex?

My understanding here is that you have a dacpac to create a table '[dbo].[TableName]' and its columnstore index, and you are attempting to deploy a dacpac but the columnstore index does not get created as it seems to be removed by this filter? is that correct?

Also I guessing its a typo, and that you used /p:DropObjectsNotInSource=False

t-johnson commented 1 week ago

@tpressleyhlr I think i have found the issue. In ObjectNameParser.cs there is logic to parse out the schema name from an identifier, and it has logic to assume an Index name has three parts. I believe this logic should be extended to cover ModelSchema.ColumnStoreIndex type also.

tpressleyhlr commented 1 week ago

@tpressleyhlr Can you explain the regex? I'm having a hard time understanding what the intent is. Did you try with a simpler regex?

Honestly we likely can simplify the regex quite a bit on our end. It's just the way that it is for 'legacy' reasons. My understanding is that the intent is simply to filter out objects that are not in the dbo/abc/xyz schemas. I did try with ^(?!\b(?i)(dbo|abc|xyz)\b).*, intended just to filter on those schemas and got the same result.

My understanding here is that you have a dacpac to create a table '[dbo].[TableName]' and its columnstore index, and you are attempting to deploy a dacpac but the columnstore index does not get created as it seems to be removed by this filter? is that correct?

Yes this is correct.

Also I guessing its a typo, and that you used /p:DropObjectsNotInSource=False

Also correct.