mirror of https://github.com/citusdata/citus.git
No need for a FormData due to many null values in the desired column order
parent
836950ff07
commit
2fbcba6c2a
|
@ -2427,19 +2427,16 @@ GetScheduledRebalanceJob(void)
|
||||||
HeapTuple jobTuple = systable_getnext(scanDescriptor);
|
HeapTuple jobTuple = systable_getnext(scanDescriptor);
|
||||||
if (HeapTupleIsValid(jobTuple))
|
if (HeapTupleIsValid(jobTuple))
|
||||||
{
|
{
|
||||||
Form_pg_dist_rebalance_job jobData = NULL;
|
|
||||||
jobData = (Form_pg_dist_rebalance_job) GETSTRUCT(jobTuple);
|
|
||||||
|
|
||||||
job = palloc0(sizeof(RebalanceJob));
|
|
||||||
job->jobid = jobData->jobid;
|
|
||||||
job->status = RebalanceJobStatusByOid(jobData->status);
|
|
||||||
|
|
||||||
/* TODO parse the actual job */
|
|
||||||
Datum datumArray[Natts_pg_dist_rebalance_jobs];
|
Datum datumArray[Natts_pg_dist_rebalance_jobs];
|
||||||
bool isNullArray[Natts_pg_dist_rebalance_jobs];
|
bool isNullArray[Natts_pg_dist_rebalance_jobs];
|
||||||
TupleDesc tupleDescriptor = RelationGetDescr(pgDistRebalanceJobs);
|
TupleDesc tupleDescriptor = RelationGetDescr(pgDistRebalanceJobs);
|
||||||
heap_deform_tuple(jobTuple, tupleDescriptor, datumArray, isNullArray);
|
heap_deform_tuple(jobTuple, tupleDescriptor, datumArray, isNullArray);
|
||||||
|
|
||||||
|
job = palloc0(sizeof(RebalanceJob));
|
||||||
|
job->jobid = DatumGetInt64(datumArray[Anum_pg_dist_rebalance_jobs_jobid - 1]);
|
||||||
|
job->status = RebalanceJobStatusByOid(
|
||||||
|
DatumGetObjectId(datumArray[Anum_pg_dist_rebalance_jobs_status - 1]));
|
||||||
|
|
||||||
job->command = text_to_cstring(
|
job->command = text_to_cstring(
|
||||||
DatumGetTextP(datumArray[Anum_pg_dist_rebalance_jobs_command - 1]));
|
DatumGetTextP(datumArray[Anum_pg_dist_rebalance_jobs_command - 1]));
|
||||||
}
|
}
|
||||||
|
@ -2475,19 +2472,15 @@ GetScheduledRebalanceJobByJobID(int64 jobId)
|
||||||
RebalanceJob *job = NULL;
|
RebalanceJob *job = NULL;
|
||||||
if (HeapTupleIsValid(jobTuple))
|
if (HeapTupleIsValid(jobTuple))
|
||||||
{
|
{
|
||||||
Form_pg_dist_rebalance_job jobData = NULL;
|
|
||||||
jobData = (Form_pg_dist_rebalance_job) GETSTRUCT(jobTuple);
|
|
||||||
|
|
||||||
job = palloc0(sizeof(RebalanceJob));
|
|
||||||
job->jobid = jobData->jobid;
|
|
||||||
job->status = RebalanceJobStatusByOid(jobData->status);
|
|
||||||
|
|
||||||
/* TODO parse the actual job */
|
|
||||||
Datum datumArray[Natts_pg_dist_rebalance_jobs];
|
Datum datumArray[Natts_pg_dist_rebalance_jobs];
|
||||||
bool isNullArray[Natts_pg_dist_rebalance_jobs];
|
bool isNullArray[Natts_pg_dist_rebalance_jobs];
|
||||||
TupleDesc tupleDescriptor = RelationGetDescr(pgDistRebalanceJobs);
|
TupleDesc tupleDescriptor = RelationGetDescr(pgDistRebalanceJobs);
|
||||||
heap_deform_tuple(jobTuple, tupleDescriptor, datumArray, isNullArray);
|
heap_deform_tuple(jobTuple, tupleDescriptor, datumArray, isNullArray);
|
||||||
|
|
||||||
|
job = palloc0(sizeof(RebalanceJob));
|
||||||
|
job->jobid = DatumGetInt64(datumArray[Anum_pg_dist_rebalance_jobs_jobid - 1]);
|
||||||
|
job->status = RebalanceJobStatusByOid(
|
||||||
|
DatumGetObjectId(datumArray[Anum_pg_dist_rebalance_jobs_status - 1]));
|
||||||
job->command = text_to_cstring(
|
job->command = text_to_cstring(
|
||||||
DatumGetTextP(datumArray[Anum_pg_dist_rebalance_jobs_command - 1]));
|
DatumGetTextP(datumArray[Anum_pg_dist_rebalance_jobs_command - 1]));
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,29 +2,6 @@
|
||||||
#ifndef CITUS_PG_DIST_REBALANCE_JOBS_H
|
#ifndef CITUS_PG_DIST_REBALANCE_JOBS_H
|
||||||
#define CITUS_PG_DIST_REBALANCE_JOBS_H
|
#define CITUS_PG_DIST_REBALANCE_JOBS_H
|
||||||
|
|
||||||
/* ----------------
|
|
||||||
* pg_dist_rebalance_job definition.
|
|
||||||
* ----------------
|
|
||||||
*/
|
|
||||||
typedef struct FormData_pg_dist_rebalance_job
|
|
||||||
{
|
|
||||||
int64 jobid;
|
|
||||||
int32 pid;
|
|
||||||
Oid status;
|
|
||||||
#ifdef CATALOG_VARLEN /* variable-length fields start here */
|
|
||||||
text command;
|
|
||||||
int32 retry_count;
|
|
||||||
text message;
|
|
||||||
#endif
|
|
||||||
} FormData_pg_dist_rebalance_job;
|
|
||||||
|
|
||||||
/* ----------------
|
|
||||||
* Form_pg_dist_colocation corresponds to a pointer to a tuple with
|
|
||||||
* the format of pg_dist_colocation relation.
|
|
||||||
* ----------------
|
|
||||||
*/
|
|
||||||
typedef FormData_pg_dist_rebalance_job *Form_pg_dist_rebalance_job;
|
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
* compiler constants for pg_dist_rebalance_jobs
|
* compiler constants for pg_dist_rebalance_jobs
|
||||||
* ----------------
|
* ----------------
|
||||||
|
|
Loading…
Reference in New Issue