mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-18 19:59:48 +08:00
Remove executor which had logic for adjusting es_processed
Previously, the executor code adjusted es_processed to set the number of tuples that have been processed in the completion tag. That was necessary since we had triggers that re-routed tuples to chunks and cancelled the inserts on the base table (thus those tuples were not counted in es_processed). We no longer use triggers and thus this logic was no longer used. In fact, this was mostly dead code because `additional_tuples` was always 0.
This commit is contained in:
parent
a9e18ae4f8
commit
c373d6b359
@ -49,7 +49,6 @@ set(HEADERS
|
||||
dimension_vector.h
|
||||
errors.h
|
||||
event_trigger.h
|
||||
executor.h
|
||||
extension.h
|
||||
guc.h
|
||||
hypercube.h
|
||||
@ -87,7 +86,6 @@ set(SOURCES
|
||||
dimension_slice.c
|
||||
dimension_vector.c
|
||||
event_trigger.c
|
||||
executor.c
|
||||
extension.c
|
||||
guc.c
|
||||
histogram.c
|
||||
|
111
src/executor.c
111
src/executor.c
@ -1,111 +0,0 @@
|
||||
#include <postgres.h>
|
||||
#include <executor/executor.h>
|
||||
#include <access/xact.h>
|
||||
|
||||
#include "executor.h"
|
||||
#include "compat.h"
|
||||
|
||||
static ExecutorRun_hook_type prev_ExecutorRun_hook;
|
||||
static uint64 additional_tuples;
|
||||
static uint64 level = 0;
|
||||
|
||||
void
|
||||
executor_add_number_tuples_processed(uint64 count)
|
||||
{
|
||||
additional_tuples += count;
|
||||
}
|
||||
|
||||
uint64
|
||||
executor_get_additional_tuples_processed()
|
||||
{
|
||||
return additional_tuples;
|
||||
}
|
||||
|
||||
void
|
||||
executor_level_enter(void)
|
||||
{
|
||||
if (0 == level)
|
||||
{
|
||||
additional_tuples = 0;
|
||||
}
|
||||
level++;
|
||||
}
|
||||
|
||||
void
|
||||
executor_level_exit(void)
|
||||
{
|
||||
level--;
|
||||
}
|
||||
|
||||
#if PG10
|
||||
static void
|
||||
timescaledb_ExecutorRun(QueryDesc *queryDesc,
|
||||
ScanDirection direction,
|
||||
uint64 count,
|
||||
bool execute_once)
|
||||
{
|
||||
executor_level_enter();
|
||||
|
||||
if (prev_ExecutorRun_hook)
|
||||
(*prev_ExecutorRun_hook) (queryDesc, direction, count, execute_once);
|
||||
else
|
||||
standard_ExecutorRun(queryDesc, direction, count, execute_once);
|
||||
|
||||
executor_level_exit();
|
||||
if (0 == level)
|
||||
{
|
||||
queryDesc->estate->es_processed += additional_tuples;
|
||||
}
|
||||
}
|
||||
|
||||
#elif PG96
|
||||
|
||||
static void
|
||||
timescaledb_ExecutorRun(QueryDesc *queryDesc,
|
||||
ScanDirection direction,
|
||||
uint64 count)
|
||||
{
|
||||
executor_level_enter();
|
||||
|
||||
if (prev_ExecutorRun_hook)
|
||||
(*prev_ExecutorRun_hook) (queryDesc, direction, count);
|
||||
else
|
||||
standard_ExecutorRun(queryDesc, direction, count);
|
||||
|
||||
executor_level_exit();
|
||||
if (0 == level)
|
||||
{
|
||||
queryDesc->estate->es_processed += additional_tuples;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
executor_AtEOXact_abort(XactEvent event, void *arg)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
case XACT_EVENT_ABORT:
|
||||
case XACT_EVENT_PARALLEL_ABORT:
|
||||
level = 0;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
_executor_init(void)
|
||||
{
|
||||
prev_ExecutorRun_hook = ExecutorRun_hook;
|
||||
ExecutorRun_hook = timescaledb_ExecutorRun;
|
||||
|
||||
RegisterXactCallback(executor_AtEOXact_abort, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
_executor_fini(void)
|
||||
{
|
||||
ExecutorRun_hook = prev_ExecutorRun_hook;
|
||||
UnregisterXactCallback(executor_AtEOXact_abort, NULL);
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
#ifndef TIMESCALEDB_EXECUTOR_H
|
||||
#define TIMESCALEDB_EXECUTOR_H
|
||||
#include <postgres.h>
|
||||
|
||||
extern void _executor_init(void);
|
||||
extern void _executor_fini(void);
|
||||
|
||||
extern void executor_add_number_tuples_processed(uint64 count);
|
||||
extern uint64 executor_get_additional_tuples_processed(void);
|
||||
|
||||
extern void executor_level_enter(void);
|
||||
extern void executor_level_exit(void);
|
||||
#endif /* TIMESCALEDB_EXECUTOR_H */
|
@ -5,7 +5,6 @@
|
||||
#include <miscadmin.h>
|
||||
#include <utils/guc.h>
|
||||
|
||||
#include "executor.h"
|
||||
#include "extension.h"
|
||||
#include "guc.h"
|
||||
#include "catalog.h"
|
||||
@ -57,7 +56,6 @@ _PG_init(void)
|
||||
_hypertable_cache_init();
|
||||
_cache_invalidate_init();
|
||||
_planner_init();
|
||||
_executor_init();
|
||||
_event_trigger_init();
|
||||
_process_utility_init();
|
||||
_parse_analyze_init();
|
||||
@ -75,7 +73,6 @@ _PG_fini(void)
|
||||
_parse_analyze_fini();
|
||||
_process_utility_fini();
|
||||
_event_trigger_fini();
|
||||
_executor_fini();
|
||||
_planner_fini();
|
||||
_cache_invalidate_fini();
|
||||
_hypertable_cache_fini();
|
||||
|
@ -35,7 +35,6 @@
|
||||
#include "copy.h"
|
||||
#include "errors.h"
|
||||
#include "event_trigger.h"
|
||||
#include "executor.h"
|
||||
#include "extension.h"
|
||||
#include "hypercube.h"
|
||||
#include "hypertable_cache.h"
|
||||
@ -231,11 +230,7 @@ process_copy(Node *parsetree, const char *query_string, char *completion_tag)
|
||||
return false;
|
||||
}
|
||||
|
||||
executor_level_enter();
|
||||
timescaledb_DoCopy(stmt, query_string, &processed, ht);
|
||||
executor_level_exit();
|
||||
|
||||
processed += executor_get_additional_tuples_processed();
|
||||
|
||||
if (completion_tag)
|
||||
snprintf(completion_tag, COMPLETION_TAG_BUFSIZE,
|
||||
|
Loading…
x
Reference in New Issue
Block a user