summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavan Deolasee2017-06-14 06:36:42 +0000
committerPavan Deolasee2017-06-14 06:36:42 +0000
commitc7e5bd77d0487dde4d7bd577562422102753ab96 (patch)
tree419632d75d3d1bf8432de699d84800bb1baccf46
parent67d631a347531d4fda6fb156ebc4090520c37ea9 (diff)
Ensure slab allocator is initialised correctly.
XL uses tuplesort facilities to merge incoming tuples from the datanode connections. We'd missed out a few things during the merge and this patch attempts to fix that. It's not clear if we have addressed all problems in this area, since the code has been heavily modified in PG10. But this patch at the very least allows further testing.
-rw-r--r--src/backend/utils/sort/tuplesort.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c
index e5bc08fff9..015e4ea93b 100644
--- a/src/backend/utils/sort/tuplesort.c
+++ b/src/backend/utils/sort/tuplesort.c
@@ -1221,6 +1221,13 @@ tuplesort_begin_merge(TupleDesc tupDesc,
PrepareSortSupportFromOrderingOp(sortOperators[i], sortKey);
}
+ /*
+ * logical tape in this case is a sorted stream
+ */
+ state->maxTapes = combiner->conn_count;
+ state->tapeRange = combiner->conn_count;
+
+ state->mergeactive = (bool *) palloc0(combiner->conn_count * sizeof(bool));
state->tp_runs = (int *) palloc0(combiner->conn_count * sizeof(int));
state->tp_dummy = (int *) palloc0(combiner->conn_count * sizeof(int));
state->tp_tapenum = (int *) palloc0(combiner->conn_count * sizeof(int));
@@ -1230,6 +1237,9 @@ tuplesort_begin_merge(TupleDesc tupDesc,
state->tp_runs[i] = 1;
state->tp_tapenum[i] = i;
}
+
+ init_slab_allocator(state, 0);
+
beginmerge(state);
state->status = TSS_FINALMERGE;