Skip to content

Commit 7b5a261

Browse files
committed
chore: get rid of estimator (#492)
* remove estimator package * remove estimator client * remove estimator API endpoint * remove estimator's dependencies from Dockerfiles * clean up configs
1 parent 0531e86 commit 7b5a261

24 files changed

+10
-1509
lines changed

engine/Dockerfile.dblab-server

-7
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@ FROM docker:20.10.12
66
RUN apk update \
77
&& apk add zfs=2.1.4-r0 --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/main \
88
&& apk add --no-cache lvm2 bash util-linux
9-
RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.13/main' >> /etc/apk/repositories \
10-
&& echo 'http://dl-cdn.alpinelinux.org/alpine/v3.13/community' >> /etc/apk/repositories \
11-
&& apk add bcc-tools=0.18.0-r0 bcc-doc=0.18.0-r0 && ln -s $(which python3) /usr/bin/python \
12-
# TODO: remove after release the PR: https://github.com/iovisor/bcc/pull/3286 (issue: https://github.com/iovisor/bcc/issues/3099)
13-
&& wget https://raw.githubusercontent.com/iovisor/bcc/master/tools/biosnoop.py -O /usr/share/bcc/tools/biosnoop
14-
15-
ENV PATH="${PATH}:/usr/share/bcc/tools"
169

1710
WORKDIR /home/dblab
1811

engine/Dockerfile.dblab-server-debug

-7
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@ FROM docker:20.10.12
1818
RUN apk update \
1919
&& apk add zfs=2.1.4-r0 --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/main \
2020
&& apk add --no-cache lvm2 bash util-linux
21-
RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.13/main' >> /etc/apk/repositories \
22-
&& echo 'http://dl-cdn.alpinelinux.org/alpine/v3.13/community' >> /etc/apk/repositories \
23-
&& apk add bcc-tools=0.18.0-r0 bcc-doc=0.18.0-r0 && ln -s $(which python3) /usr/bin/python \
24-
# TODO: remove after release the PR: https://github.com/iovisor/bcc/pull/3286 (issue: https://github.com/iovisor/bcc/issues/3099)
25-
&& wget https://raw.githubusercontent.com/iovisor/bcc/master/tools/biosnoop.py -O /usr/share/bcc/tools/biosnoop
26-
27-
ENV PATH="${PATH}:/usr/share/bcc/tools"
2821

2922
WORKDIR /home/dblab
3023

engine/Dockerfile.dblab-server-zfs08

-7
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@ FROM docker:20.10.12
55
# Install dependencies.
66
RUN apk update && apk add zfs=0.8.4-r0 --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/v3.12/main \
77
&& apk add --no-cache lvm2 bash util-linux
8-
RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.13/main' >> /etc/apk/repositories \
9-
&& echo 'http://dl-cdn.alpinelinux.org/alpine/v3.13/community' >> /etc/apk/repositories \
10-
&& apk add bcc-tools=0.18.0-r0 bcc-doc=0.18.0-r0 && ln -s $(which python3) /usr/bin/python \
11-
# TODO: remove after release the PR: https://github.com/iovisor/bcc/pull/3286 (issue: https://github.com/iovisor/bcc/issues/3099)
12-
&& wget https://raw.githubusercontent.com/iovisor/bcc/master/tools/biosnoop.py -O /usr/share/bcc/tools/biosnoop
13-
14-
ENV PATH="${PATH}:/usr/share/bcc/tools"
158

169
WORKDIR /home/dblab
1710

engine/api/swagger-spec/dblab_server_swagger.yaml

-42
Original file line numberDiff line numberDiff line change
@@ -419,48 +419,6 @@ paths:
419419
schema:
420420
$ref: "#/definitions/Error"
421421

422-
/estimate:
423-
get:
424-
tags:
425-
- "observation"
426-
summary: "Run clone estimator"
427-
description: ""
428-
operationId: "runEstimator"
429-
consumes:
430-
- "application/json"
431-
produces:
432-
- "application/json"
433-
parameters:
434-
- in: header
435-
name: Verification-Token
436-
type: string
437-
required: true
438-
- in: path
439-
required: true
440-
name: "clone_id"
441-
type: "string"
442-
description: "Clone ID"
443-
- in: path
444-
required: true
445-
name: "pid"
446-
type: "string"
447-
description: "Process ID"
448-
responses:
449-
200:
450-
description: "The estimation session has been finished successfully."
451-
400:
452-
description: "Bad request"
453-
schema:
454-
$ref: "#/definitions/Error"
455-
404:
456-
description: "Not found"
457-
schema:
458-
$ref: "#/definitions/Error"
459-
500:
460-
description: "Internal server error"
461-
schema:
462-
$ref: "#/definitions/Error"
463-
464422
/instance/retrieval:
465423
get:
466424
tags:

engine/cmd/database-lab/main.go

+5-11
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
"gitlab.com/postgres-ai/database-lab/v3/internal/cloning"
2626
"gitlab.com/postgres-ai/database-lab/v3/internal/diagnostic"
2727
"gitlab.com/postgres-ai/database-lab/v3/internal/embeddedui"
28-
"gitlab.com/postgres-ai/database-lab/v3/internal/estimator"
2928
"gitlab.com/postgres-ai/database-lab/v3/internal/observer"
3029
"gitlab.com/postgres-ai/database-lab/v3/internal/platform"
3130
"gitlab.com/postgres-ai/database-lab/v3/internal/provision"
@@ -158,7 +157,6 @@ func main() {
158157
}
159158

160159
obs := observer.NewObserver(docker, &cfg.Observer, pm)
161-
est := estimator.NewEstimator(&cfg.Estimator)
162160

163161
go removeObservingClones(observingChan, obs)
164162

@@ -187,7 +185,6 @@ func main() {
187185
pm,
188186
cloningSvc,
189187
platformSvc,
190-
est,
191188
embeddedUI,
192189
server,
193190
logCleaner,
@@ -196,10 +193,10 @@ func main() {
196193
}
197194

198195
server := srv.NewServer(&cfg.Server, &cfg.Global, engProps, docker, cloningSvc, provisioner, retrievalSvc, platformSvc,
199-
obs, est, pm, tm, tokenHolder, logFilter, embeddedUI, reloadConfigFn)
196+
obs, pm, tm, tokenHolder, logFilter, embeddedUI, reloadConfigFn)
200197
shutdownCh := setShutdownListener()
201198

202-
go setReloadListener(ctx, provisioner, tm, retrievalSvc, pm, cloningSvc, platformSvc, est, embeddedUI, server,
199+
go setReloadListener(ctx, provisioner, tm, retrievalSvc, pm, cloningSvc, platformSvc, embeddedUI, server,
203200
logCleaner, logFilter)
204201

205202
server.InitHandlers()
@@ -281,8 +278,7 @@ func getEngineProperties(ctx context.Context, dockerCLI *client.Client, cfg *con
281278

282279
func reloadConfig(ctx context.Context, provisionSvc *provision.Provisioner, tm *telemetry.Agent,
283280
retrievalSvc *retrieval.Retrieval, pm *pool.Manager, cloningSvc *cloning.Base, platformSvc *platform.Service,
284-
est *estimator.Estimator, embeddedUI *embeddedui.UIManager, server *srv.Server, cleaner *diagnostic.Cleaner,
285-
filtering *log.Filtering) error {
281+
embeddedUI *embeddedui.UIManager, server *srv.Server, cleaner *diagnostic.Cleaner, filtering *log.Filtering) error {
286282
cfg, err := config.LoadConfiguration()
287283
if err != nil {
288284
return err
@@ -327,23 +323,21 @@ func reloadConfig(ctx context.Context, provisionSvc *provision.Provisioner, tm *
327323
retrievalSvc.Reload(ctx, newRetrievalConfig)
328324
cloningSvc.Reload(cfg.Cloning)
329325
platformSvc.Reload(newPlatformSvc)
330-
est.Reload(cfg.Estimator)
331326
server.Reload(cfg.Server)
332327

333328
return nil
334329
}
335330

336331
func setReloadListener(ctx context.Context, provisionSvc *provision.Provisioner, tm *telemetry.Agent,
337332
retrievalSvc *retrieval.Retrieval, pm *pool.Manager, cloningSvc *cloning.Base, platformSvc *platform.Service,
338-
est *estimator.Estimator, embeddedUI *embeddedui.UIManager, server *srv.Server, cleaner *diagnostic.Cleaner,
339-
logFilter *log.Filtering) {
333+
embeddedUI *embeddedui.UIManager, server *srv.Server, cleaner *diagnostic.Cleaner, logFilter *log.Filtering) {
340334
reloadCh := make(chan os.Signal, 1)
341335
signal.Notify(reloadCh, syscall.SIGHUP)
342336

343337
for range reloadCh {
344338
log.Msg("Reloading configuration")
345339

346-
if err := reloadConfig(ctx, provisionSvc, tm, retrievalSvc, pm, cloningSvc, platformSvc, est, embeddedUI, server,
340+
if err := reloadConfig(ctx, provisionSvc, tm, retrievalSvc, pm, cloningSvc, platformSvc, embeddedUI, server,
347341
cleaner, logFilter); err != nil {
348342
log.Err("Failed to reload configuration", err)
349343
}

engine/configs/config.example.logical_generic.yml

-13
Original file line numberDiff line numberDiff line change
@@ -393,16 +393,3 @@ diagnostic:
393393
# "select \\d+": "***"
394394
# "[a-z0-9._%+\\-]+(@[a-z0-9.\\-]+\\.[a-z]{2,4})": "***$1"
395395
#
396-
# Tool to calculate timing difference between Database Lab and production environments.
397-
#estimator:
398-
# # The ratio evaluating the timing difference for operations involving IO Read between Database Lab and production environments.
399-
# readRatio: 1
400-
#
401-
# # The ratio evaluating the timing difference for operations involving IO Write between Database Lab and production environments.
402-
# writeRatio: 1
403-
#
404-
# # Time interval of samples taken by the profiler.
405-
# profilingInterval: 10ms
406-
#
407-
# # The minimum number of samples sufficient to display the estimation results.
408-
# sampleThreshold: 20

engine/configs/config.example.logical_rds_iam.yml

-13
Original file line numberDiff line numberDiff line change
@@ -394,16 +394,3 @@ diagnostic:
394394
# "select \\d+": "***"
395395
# "[a-z0-9._%+\\-]+(@[a-z0-9.\\-]+\\.[a-z]{2,4})": "***$1"
396396
#
397-
# Tool to calculate timing difference between Database Lab and production environments.
398-
#estimator:
399-
# # The ratio evaluating the timing difference for operations involving IO Read between Database Lab and production environments.
400-
# readRatio: 1
401-
#
402-
# # The ratio evaluating the timing difference for operations involving IO Write between Database Lab and production environments.
403-
# writeRatio: 1
404-
#
405-
# # Time interval of samples taken by the profiler.
406-
# profilingInterval: 10ms
407-
#
408-
# # The minimum number of samples sufficient to display the estimation results.
409-
# sampleThreshold: 20

engine/configs/config.example.physical_generic.yml

-13
Original file line numberDiff line numberDiff line change
@@ -346,16 +346,3 @@ diagnostic:
346346
# "select \\d+": "***"
347347
# "[a-z0-9._%+\\-]+(@[a-z0-9.\\-]+\\.[a-z]{2,4})": "***$1"
348348
#
349-
# Tool to calculate timing difference between Database Lab and production environments.
350-
#estimator:
351-
# # The ratio evaluating the timing difference for operations involving IO Read between Database Lab and production environments.
352-
# readRatio: 1
353-
#
354-
# # The ratio evaluating the timing difference for operations involving IO Write between Database Lab and production environments.
355-
# writeRatio: 1
356-
#
357-
# # Time interval of samples taken by the profiler.
358-
# profilingInterval: 10ms
359-
#
360-
# # The minimum number of samples sufficient to display the estimation results.
361-
# sampleThreshold: 20

engine/configs/config.example.physical_pgbackrest.yml

-14
Original file line numberDiff line numberDiff line change
@@ -364,17 +364,3 @@ diagnostic:
364364
# "regexp": "replace"
365365
# "select \\d+": "***"
366366
# "[a-z0-9._%+\\-]+(@[a-z0-9.\\-]+\\.[a-z]{2,4})": "***$1"
367-
#
368-
# Tool to calculate timing difference between Database Lab and production environments.
369-
#estimator:
370-
# # The ratio evaluating the timing difference for operations involving IO Read between Database Lab and production environments.
371-
# readRatio: 1
372-
#
373-
# # The ratio evaluating the timing difference for operations involving IO Write between Database Lab and production environments.
374-
# writeRatio: 1
375-
#
376-
# # Time interval of samples taken by the profiler.
377-
# profilingInterval: 10ms
378-
#
379-
# # The minimum number of samples sufficient to display the estimation results.
380-
# sampleThreshold: 20

engine/configs/config.example.physical_walg.yml

-14
Original file line numberDiff line numberDiff line change
@@ -337,17 +337,3 @@ diagnostic:
337337
# "regexp": "replace"
338338
# "select \\d+": "***"
339339
# "[a-z0-9._%+\\-]+(@[a-z0-9.\\-]+\\.[a-z]{2,4})": "***$1"
340-
#
341-
# Tool to calculate timing difference between Database Lab and production environments.
342-
#estimator:
343-
# # The ratio evaluating the timing difference for operations involving IO Read between Database Lab and production environments.
344-
# readRatio: 1
345-
#
346-
# # The ratio evaluating the timing difference for operations involving IO Write between Database Lab and production environments.
347-
# writeRatio: 1
348-
#
349-
# # Time interval of samples taken by the profiler.
350-
# profilingInterval: 10ms
351-
#
352-
# # The minimum number of samples sufficient to display the estimation results.
353-
# sampleThreshold: 20

engine/internal/estimator/estimator.go

-58
This file was deleted.

engine/internal/estimator/estimator_test.go

-75
This file was deleted.

0 commit comments

Comments
 (0)