mirror of https://github.com/citusdata/citus.git
Implement BuildStripeMetadata
parent
2552aee404
commit
f846c16514
|
@ -71,6 +71,7 @@ static void GetHighestUsedAddressAndId(uint64 storageId,
|
||||||
uint64 *highestUsedAddress,
|
uint64 *highestUsedAddress,
|
||||||
uint64 *highestUsedId);
|
uint64 *highestUsedId);
|
||||||
static List * ReadDataFileStripeList(uint64 storageId, Snapshot snapshot);
|
static List * ReadDataFileStripeList(uint64 storageId, Snapshot snapshot);
|
||||||
|
static StripeMetadata * BuildStripeMetadata(Datum *datumArray);
|
||||||
static uint32 * ReadChunkGroupRowCounts(uint64 storageId, uint64 stripe, uint32
|
static uint32 * ReadChunkGroupRowCounts(uint64 storageId, uint64 stripe, uint32
|
||||||
chunkGroupCount);
|
chunkGroupCount);
|
||||||
static Oid ColumnarStorageIdSequenceRelationId(void);
|
static Oid ColumnarStorageIdSequenceRelationId(void);
|
||||||
|
@ -840,24 +841,7 @@ ReadDataFileStripeList(uint64 storageId, Snapshot snapshot)
|
||||||
bool isNullArray[Natts_columnar_stripe];
|
bool isNullArray[Natts_columnar_stripe];
|
||||||
|
|
||||||
heap_deform_tuple(heapTuple, tupleDescriptor, datumArray, isNullArray);
|
heap_deform_tuple(heapTuple, tupleDescriptor, datumArray, isNullArray);
|
||||||
|
StripeMetadata *stripeMetadata = BuildStripeMetadata(datumArray);
|
||||||
StripeMetadata *stripeMetadata = palloc0(sizeof(StripeMetadata));
|
|
||||||
stripeMetadata->id = DatumGetInt64(datumArray[Anum_columnar_stripe_stripe - 1]);
|
|
||||||
stripeMetadata->fileOffset = DatumGetInt64(
|
|
||||||
datumArray[Anum_columnar_stripe_file_offset - 1]);
|
|
||||||
stripeMetadata->dataLength = DatumGetInt64(
|
|
||||||
datumArray[Anum_columnar_stripe_data_length - 1]);
|
|
||||||
stripeMetadata->columnCount = DatumGetInt32(
|
|
||||||
datumArray[Anum_columnar_stripe_column_count - 1]);
|
|
||||||
stripeMetadata->chunkCount = DatumGetInt32(
|
|
||||||
datumArray[Anum_columnar_stripe_chunk_count - 1]);
|
|
||||||
stripeMetadata->chunkGroupRowCount = DatumGetInt32(
|
|
||||||
datumArray[Anum_columnar_stripe_chunk_row_count - 1]);
|
|
||||||
stripeMetadata->rowCount = DatumGetInt64(
|
|
||||||
datumArray[Anum_columnar_stripe_row_count - 1]);
|
|
||||||
stripeMetadata->firstRowNumber = DatumGetUInt64(
|
|
||||||
datumArray[Anum_columnar_stripe_first_row_number - 1]);
|
|
||||||
|
|
||||||
stripeMetadataList = lappend(stripeMetadataList, stripeMetadata);
|
stripeMetadataList = lappend(stripeMetadataList, stripeMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -869,6 +853,32 @@ ReadDataFileStripeList(uint64 storageId, Snapshot snapshot)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* BuildStripeMetadata builds a StripeMetadata object from given datumArray.
|
||||||
|
*/
|
||||||
|
static StripeMetadata *
|
||||||
|
BuildStripeMetadata(Datum *datumArray)
|
||||||
|
{
|
||||||
|
StripeMetadata *stripeMetadata = palloc0(sizeof(StripeMetadata));
|
||||||
|
stripeMetadata->id = DatumGetInt64(datumArray[Anum_columnar_stripe_stripe - 1]);
|
||||||
|
stripeMetadata->fileOffset = DatumGetInt64(
|
||||||
|
datumArray[Anum_columnar_stripe_file_offset - 1]);
|
||||||
|
stripeMetadata->dataLength = DatumGetInt64(
|
||||||
|
datumArray[Anum_columnar_stripe_data_length - 1]);
|
||||||
|
stripeMetadata->columnCount = DatumGetInt32(
|
||||||
|
datumArray[Anum_columnar_stripe_column_count - 1]);
|
||||||
|
stripeMetadata->chunkCount = DatumGetInt32(
|
||||||
|
datumArray[Anum_columnar_stripe_chunk_count - 1]);
|
||||||
|
stripeMetadata->chunkGroupRowCount = DatumGetInt32(
|
||||||
|
datumArray[Anum_columnar_stripe_chunk_row_count - 1]);
|
||||||
|
stripeMetadata->rowCount = DatumGetInt64(
|
||||||
|
datumArray[Anum_columnar_stripe_row_count - 1]);
|
||||||
|
stripeMetadata->firstRowNumber = DatumGetUInt64(
|
||||||
|
datumArray[Anum_columnar_stripe_first_row_number - 1]);
|
||||||
|
return stripeMetadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DeleteMetadataRows removes the rows with given relfilenode from columnar
|
* DeleteMetadataRows removes the rows with given relfilenode from columnar
|
||||||
* metadata tables.
|
* metadata tables.
|
||||||
|
|
Loading…
Reference in New Issue