Skip to content

Commit

Permalink
Uninstall OLE and ODBC drivers during SQL Server uninstall.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 627757351
  • Loading branch information
p3rf Team authored and copybara-github committed Apr 24, 2024
1 parent beec76b commit aff6c20
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,10 @@ $sql_install_file = (Get-SqlInstallSourceDirectory) + 'Setup.exe'
Write-Host $sql_install_file

& $sql_install_file $parameters

# Uninstall OLE drivers
Get-Package -Name 'Microsoft OLE*' | Uninstall-Package -Force

# Uninstall ODBC drivers
Get-Package -Name 'Microsoft ODBC*' | Uninstall-Package -Force

43 changes: 3 additions & 40 deletions perfkitbenchmarker/linux_packages/ycsb.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

from collections.abc import Mapping, Sequence
import copy
import dataclasses
import datetime
import io
import logging
Expand Down Expand Up @@ -1341,25 +1340,6 @@ def _RunLowestLatencyMode(
Returns:
A list of samples of benchmark results.
"""

@dataclasses.dataclass
class _ThroughputLatencyResult:
throughput: int = 0
read_latency: float = float('inf')
update_latency: float = float('inf')
samples: list[sample.Sample] = dataclasses.field(default_factory=list)

def _PrintDebugLog(result: _ThroughputLatencyResult) -> None:
logging.info(
'Run had throughput %s ops/s, read %s latency %s ms, update %s'
' latency %s ms',
result.throughput,
_LOWEST_LATENCY_PERCENTILE,
result.read_latency,
_LOWEST_LATENCY_PERCENTILE,
result.update_latency,
)

def _RunWorkload(target_qps: int) -> list[sample.Sample]:
"""Runs the workload at the target throughput."""
run_params = _GetRunParameters()
Expand All @@ -1370,23 +1350,6 @@ def _RunWorkload(target_qps: int) -> list[sample.Sample]:
self._SetRunParameters(run_params)
return self.RunStaircaseLoads([vms[0]], workloads, **run_kwargs)

def _ExtractStats(samples: list[sample.Sample]) -> _ThroughputLatencyResult:
"""Returns the throughput and latency recorded in the samples."""
throughput, read_latency, update_latency = 0, 0, 0
for result in samples:
if result.metric == 'overall Throughput':
throughput = result.value
elif result.metric == f'read {_LOWEST_LATENCY_PERCENTILE} latency':
read_latency = result.value
elif result.metric == f'update {_LOWEST_LATENCY_PERCENTILE} latency':
update_latency = result.value
return _ThroughputLatencyResult(
throughput=int(throughput),
read_latency=read_latency,
update_latency=update_latency,
samples=samples,
)

def _ProcessSamples(
samples: list[sample.Sample], database: resource.BaseResource
) -> list[sample.Sample]:
Expand Down Expand Up @@ -1431,11 +1394,11 @@ def _ProcessSamples(
target = _LOWEST_LATENCY_STARTING_QPS
min_read_latency = float('inf')
min_update_latency = float('inf')
prev_result = _ThroughputLatencyResult()
prev_result = ycsb_stats.ThroughputLatencyResult()
while True:
samples = _RunWorkload(target)
result = _ExtractStats(samples)
_PrintDebugLog(result)
result = ycsb_stats.ExtractStats(samples, _LOWEST_LATENCY_PERCENTILE)
logging.info('Run stats: %s', result)
if (
result.read_latency > min_read_latency + _LOWEST_LATENCY_BUFFER
or result.update_latency > min_update_latency + _LOWEST_LATENCY_BUFFER
Expand Down
39 changes: 39 additions & 0 deletions perfkitbenchmarker/linux_packages/ycsb_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -1102,3 +1102,42 @@ def CreateSamples(
'',
{'latency_time_series': group.data},
)


@dataclasses.dataclass
class ThroughputLatencyResult:
"""Post-processing helper class for YCSB datapoints."""

throughput: int = 0
percentile: str = ''
read_latency: float = float('inf')
update_latency: float = float('inf')
samples: list[sample.Sample] = dataclasses.field(default_factory=list)

def __str__(self) -> str:
return (
f'({self.throughput} ops/s, '
f'{self.percentile} read latency: {self.read_latency}, '
f'{self.percentile} update latency: {self.update_latency})'
)


def ExtractStats(
samples: list[sample.Sample], percentile: str
) -> ThroughputLatencyResult:
"""Returns the throughput and latency recorded in the samples."""
throughput, read_latency, update_latency = 0, 0, 0
for result in samples:
if result.metric == 'overall Throughput':
throughput = result.value
elif result.metric == f'read {percentile} latency':
read_latency = result.value
elif result.metric == f'update {percentile} latency':
update_latency = result.value
return ThroughputLatencyResult(
throughput=int(throughput),
percentile=percentile,
read_latency=read_latency,
update_latency=update_latency,
samples=samples,
)
8 changes: 5 additions & 3 deletions tests/linux_packages/ycsb_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,16 +260,18 @@ def _GetMockThroughputSamples(throughputs):
return result


def _GetMockThroughputLatencySamples(throughput, read_latency, update_latency):
def _GetMockThroughputLatencySamples(
throughput, read_latency, update_latency, percentile='p95'
):
return [
sample.Sample('overall Throughput', value=throughput, unit='ops/sec'),
sample.Sample(
f'read {ycsb._LOWEST_LATENCY_PERCENTILE} latency',
f'read {percentile} latency',
value=read_latency,
unit='ms',
),
sample.Sample(
f'update {ycsb._LOWEST_LATENCY_PERCENTILE} latency',
f'update {percentile} latency',
value=update_latency,
unit='ms',
),
Expand Down

0 comments on commit aff6c20

Please sign in to comment.