Skip to content

Commit 4b24a3e

Browse files
committed
mssql perf tests
1 parent 3ecaf6e commit 4b24a3e

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

airbyte-cdk/bulk/core/load/src/testFixtures/kotlin/io/airbyte/cdk/load/write/BasicPerformanceTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ data class PerformanceTestSummary(
8989
val namespace: String?,
9090
val streamName: String,
9191
val recordCount: Long?,
92+
val expectedRecordCount: Long,
9293
val emittedRecordCount: Long,
9394
val recordPerSeconds: Double,
9495
val megabytePerSeconds: Double,
@@ -335,6 +336,7 @@ abstract class BasicPerformanceTest(
335336
namespace = testScenario.catalog.streams[0].descriptor.namespace,
336337
streamName = testScenario.catalog.streams[0].descriptor.name,
337338
recordCount = recordCount,
339+
expectedRecordCount = summary.expectedRecordsCount,
338340
emittedRecordCount = summary.records,
339341
recordPerSeconds = recordPerSeconds,
340342
megabytePerSeconds = megabytePerSeconds,

airbyte-integrations/connectors/destination-mssql-v2/src/main/kotlin/io/airbyte/integrations/destination/mssql/v2/MSSQLQueryBuilder.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,15 @@ const val CREATE_INDEX_QUERY = """
117117

118118
const val INSERT_INTO_QUERY =
119119
"""
120-
INSERT INTO [?$SCHEMA_KEY].[?$TABLE_KEY] (?$COLUMNS_KEY)
120+
SET NOCOUNT ON;
121+
INSERT INTO [?$SCHEMA_KEY].[?$TABLE_KEY] WITH (TABLOCK) (?$COLUMNS_KEY)
121122
SELECT table_value.*
122123
FROM (VALUES (?$TEMPLATE_COLUMNS_KEY)) table_value(?$COLUMNS_KEY)
123124
"""
124125

125126
const val MERGE_INTO_QUERY =
126127
"""
128+
SET NOCOUNT ON;
127129
MERGE INTO [?$SCHEMA_KEY].[?$TABLE_KEY] AS Target
128130
USING (VALUES (?$TEMPLATE_COLUMNS_KEY)) AS Source (?$COLUMNS_KEY)
129131
ON ?$UNIQUENESS_CONSTRAINT_KEY
@@ -138,6 +140,7 @@ const val ALTER_TABLE_ADD = """
138140
ALTER TABLE [?].[?]
139141
ADD [?] ? NULL;
140142
"""
143+
141144
const val ALTER_TABLE_DROP = """
142145
ALTER TABLE [?].[?]
143146
DROP COLUMN [?];
@@ -164,6 +167,11 @@ const val SELECT_FROM = """
164167
FROM [?].[?]
165168
"""
166169

170+
const val COUNT_FROM = """
171+
SELECT COUNT(*)
172+
FROM [?].[?]
173+
"""
174+
167175
class MSSQLQueryBuilder(
168176
config: MSSQLConfiguration,
169177
private val stream: DestinationStream,
@@ -204,7 +212,7 @@ class MSSQLQueryBuilder(
204212

205213
val outputSchema: String = stream.descriptor.namespace ?: config.schema
206214
val tableName: String = stream.descriptor.name
207-
private val uniquenessKey: List<String> =
215+
val uniquenessKey: List<String> =
208216
when (stream.importType) {
209217
is Dedupe ->
210218
if ((stream.importType as Dedupe).primaryKey.isNotEmpty()) {

airbyte-integrations/connectors/destination-mssql-v2/src/main/kotlin/io/airbyte/integrations/destination/mssql/v2/config/DataSourceFactory.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ class DataSourceFactory {
1919
val sqlServerDataSource = config.toSQLServerDataSource()
2020
val dataSource = HikariDataSource()
2121
dataSource.dataSource = sqlServerDataSource
22-
dataSource.connectionTimeout = 30000
22+
dataSource.connectionTimeout = 60000
2323
dataSource.connectionTestQuery = "SELECT 1"
2424
dataSource.maximumPoolSize = 10
2525
dataSource.minimumIdle = 0
2626
dataSource.idleTimeout = 60000
27-
dataSource.leakDetectionThreshold = dataSource.connectionTimeout + 10000
27+
dataSource.leakDetectionThreshold = dataSource.connectionTimeout + 30000
2828
return dataSource
2929
}
3030
}

0 commit comments

Comments
 (0)