-
Notifications
You must be signed in to change notification settings - Fork 695
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5dfdcc8
commit 3e2cf73
Showing
17 changed files
with
214 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/backend/distributed/sql/udfs/citus_stats_tenants_local_reset/11.3-1.sql
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
src/backend/distributed/sql/udfs/citus_stats_tenants_local_reset/latest.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CREATE OR REPLACE FUNCTION pg_catalog.citus_stats_tenants_local_reset() | ||
RETURNS VOID | ||
LANGUAGE C STRICT | ||
AS 'MODULE_PATHNAME', $$citus_stats_tenants_local_reset$$; | ||
|
||
COMMENT ON FUNCTION pg_catalog.citus_stats_tenants_local_reset() | ||
IS 'resets the local tenant statistics'; |
8 changes: 8 additions & 0 deletions
8
src/backend/distributed/sql/udfs/citus_stats_tenants_reset/11.3-1.sql
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
src/backend/distributed/sql/udfs/citus_stats_tenants_reset/latest.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CREATE OR REPLACE FUNCTION pg_catalog.citus_stats_tenants_reset() | ||
RETURNS VOID | ||
LANGUAGE plpgsql | ||
AS $function$ | ||
BEGIN | ||
PERFORM run_command_on_all_nodes($$SELECT citus_stats_tenants_local_reset()$$); | ||
END; | ||
$function$; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/*------------------------------------------------------------------------- | ||
* | ||
* citus_stat_tenants.c | ||
* | ||
* This file contains functions to test citus_stats_tenants. | ||
* | ||
* Copyright (c) Citus Data, Inc. | ||
* | ||
*------------------------------------------------------------------------- | ||
*/ | ||
|
||
#include "postgres.h" | ||
#include "fmgr.h" | ||
|
||
#include "distributed/utils/attribute.h" | ||
#include "sys/time.h" | ||
|
||
PG_FUNCTION_INFO_V1(sleep_until_next_period); | ||
|
||
/* | ||
* sleep_until_next_period sleeps until the next monitoring period starts. | ||
*/ | ||
Datum | ||
sleep_until_next_period(PG_FUNCTION_ARGS) | ||
{ | ||
struct timeval currentTime; | ||
gettimeofday(¤tTime, NULL); | ||
|
||
long int nextPeriodStart = currentTime.tv_sec - | ||
(currentTime.tv_sec % CitusStatsTenantsPeriod) + | ||
CitusStatsTenantsPeriod; | ||
|
||
long int sleepTime = (nextPeriodStart - currentTime.tv_sec) * 1000000 - | ||
currentTime.tv_usec + 100000; | ||
pg_usleep(sleepTime); | ||
|
||
PG_RETURN_VOID(); | ||
} |
Oops, something went wrong.