summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavan Deolasee2016-08-05 05:37:07 +0000
committerPavan Deolasee2016-10-18 10:07:42 +0000
commit8778bfbaf92079f4add491228c01058b655e57e5 (patch)
treeee97417950d5d517107a10dc211c46c3debfcc52
parent7ec90f608bca6f3fb44dc8f60a4b986c82a1d69a (diff)
Report execution stats for each step of redistribution and also call
tuplestore_end() at the end instead of just tuplestore_clear() which neither frees up resources nor prints the stats
-rw-r--r--src/backend/pgxc/locator/redistrib.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/backend/pgxc/locator/redistrib.c b/src/backend/pgxc/locator/redistrib.c
index e57cf2e7d9..eecca4781e 100644
--- a/src/backend/pgxc/locator/redistrib.c
+++ b/src/backend/pgxc/locator/redistrib.c
@@ -345,29 +345,42 @@ pgxc_redist_add_reindex(RedistribState *distribState)
static void
distrib_execute_command(RedistribState *distribState, RedistribCommand *command)
{
+ struct rusage start_r;
+ struct timeval start_t;
+ char *command_str;
+
+ ResetUsageCommon(&start_r, &start_t);
+
/* Execute redistribution command */
switch (command->type)
{
case DISTRIB_COPY_TO:
distrib_copy_to(distribState);
+ command_str = "Redistribution step: fetch remote tuples";
break;
case DISTRIB_COPY_FROM:
distrib_copy_from(distribState, command->execNodes);
+ command_str = "Redistribution step: distribute tuples";
break;
case DISTRIB_TRUNCATE:
distrib_truncate(distribState, command->execNodes);
+ command_str = "Redistribution step: truncate relation";
break;
case DISTRIB_REINDEX:
distrib_reindex(distribState, command->execNodes);
+ command_str = "Redistribution step: reindex relation";
break;
case DISTRIB_DELETE_HASH:
case DISTRIB_DELETE_MODULO:
distrib_delete_hash(distribState, command->execNodes);
+ command_str = "Redistribution step: delete tuples";
break;
case DISTRIB_NONE:
default:
Assert(0); /* Should not happen */
}
+
+ ShowUsageCommon(command_str, &start_r, &start_t);
}
@@ -416,6 +429,8 @@ distrib_copy_to(RedistribState *distribState)
/* Create tuplestore storage */
store = tuplestore_begin_message(false, work_mem);
+ tuplestore_collect_stat(store, "Redistribute_TS");
+
/* Then get rows and copy them to the tuplestore used for redistribution */
DataNodeCopyStore(
(PGXCNodeHandle **) getLocatorNodeMap(copyState->locator),
@@ -824,7 +839,8 @@ FreeRedistribState(RedistribState *state)
if (list_length(state->commands) > 0)
list_free(state->commands);
if (state->store)
- tuplestore_clear(state->store);
+ tuplestore_end(state->store);
+ pfree(state);
}
/*