feat(unified-storage): prune history table based on limits (#101970)
This commit is contained in:
committed by
GitHub
parent
cacdf00067
commit
1700a8aa9f
22
pkg/storage/unified/sql/testdata/mysql--resource_history_prune-simple.sql
vendored
Executable file
22
pkg/storage/unified/sql/testdata/mysql--resource_history_prune-simple.sql
vendored
Executable file
@@ -0,0 +1,22 @@
|
||||
DELETE FROM `resource_history`
|
||||
WHERE `guid` IN (
|
||||
SELECT `guid`
|
||||
FROM (
|
||||
SELECT
|
||||
`guid`,
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY
|
||||
`namespace`,
|
||||
`group`,
|
||||
`resource`,
|
||||
`name`
|
||||
ORDER BY `resource_version` DESC
|
||||
) AS `rn`
|
||||
FROM `resource_history`
|
||||
WHERE
|
||||
`namespace` = 'nn'
|
||||
AND `group` = 'gg'
|
||||
AND `resource` = 'rr'
|
||||
) AS `ranked`
|
||||
WHERE `rn` > 100
|
||||
);
|
||||
22
pkg/storage/unified/sql/testdata/postgres--resource_history_prune-simple.sql
vendored
Executable file
22
pkg/storage/unified/sql/testdata/postgres--resource_history_prune-simple.sql
vendored
Executable file
@@ -0,0 +1,22 @@
|
||||
DELETE FROM "resource_history"
|
||||
WHERE "guid" IN (
|
||||
SELECT "guid"
|
||||
FROM (
|
||||
SELECT
|
||||
"guid",
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY
|
||||
"namespace",
|
||||
"group",
|
||||
"resource",
|
||||
"name"
|
||||
ORDER BY "resource_version" DESC
|
||||
) AS "rn"
|
||||
FROM "resource_history"
|
||||
WHERE
|
||||
"namespace" = 'nn'
|
||||
AND "group" = 'gg'
|
||||
AND "resource" = 'rr'
|
||||
) AS "ranked"
|
||||
WHERE "rn" > 100
|
||||
);
|
||||
22
pkg/storage/unified/sql/testdata/sqlite--resource_history_prune-simple.sql
vendored
Executable file
22
pkg/storage/unified/sql/testdata/sqlite--resource_history_prune-simple.sql
vendored
Executable file
@@ -0,0 +1,22 @@
|
||||
DELETE FROM "resource_history"
|
||||
WHERE "guid" IN (
|
||||
SELECT "guid"
|
||||
FROM (
|
||||
SELECT
|
||||
"guid",
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY
|
||||
"namespace",
|
||||
"group",
|
||||
"resource",
|
||||
"name"
|
||||
ORDER BY "resource_version" DESC
|
||||
) AS "rn"
|
||||
FROM "resource_history"
|
||||
WHERE
|
||||
"namespace" = 'nn'
|
||||
AND "group" = 'gg'
|
||||
AND "resource" = 'rr'
|
||||
) AS "ranked"
|
||||
WHERE "rn" > 100
|
||||
);
|
||||
Reference in New Issue
Block a user