Core/DataStores: Remove temporary 10.0.7 workraround

This commit is contained in:
Shauren
2023-05-05 00:45:11 +02:00
parent 16bc74667e
commit 3bd4c21754
2 changed files with 5 additions and 25 deletions

View File

@@ -26,10 +26,6 @@
#include <utility>
#include <cstring>
class Temporary_10_0_7_metadata_bug_workaround : public std::exception
{
};
enum class DB2ColumnCompression : uint32
{
None,
@@ -237,7 +233,7 @@ public:
char const* GetExpectedSignMismatchReason(uint32 field) const override;
private:
void FillParentLookup(char* dataTable, char** indexTable);
void FillParentLookup(char* dataTable);
uint32 GetRecordSection(uint32 recordNumber) const;
unsigned char const* GetRawRecordData(uint32 recordNumber, uint32 const* section) const override;
uint32 RecordGetId(uint8 const* record, uint32 recordIndex) const override;
@@ -439,8 +435,6 @@ char* DB2FileLoaderRegularImpl::AutoProduceData(uint32& indexTableSize, char**&
++fieldIndex;
}
try
{
for (uint32 x = 0; x < _header->FieldCount; ++x)
{
for (uint32 z = 0; z < _loadInfo->Meta->Fields[x].ArraySize; ++z)
@@ -512,17 +506,11 @@ char* DB2FileLoaderRegularImpl::AutoProduceData(uint32& indexTableSize, char**&
++fieldIndex;
}
}
}
catch (Temporary_10_0_7_metadata_bug_workaround const&)
{
// pretend this record doesnt exist, has overflown column
indexTable[indexVal] = nullptr;
}
}
}
if (!_parentIndexes.empty())
FillParentLookup(dataTable, indexTable);
FillParentLookup(dataTable);
return dataTable;
}
@@ -652,7 +640,7 @@ void DB2FileLoaderRegularImpl::AutoProduceRecordCopies(uint32 records, char** in
}
}
void DB2FileLoaderRegularImpl::FillParentLookup(char* dataTable, char** indexTable)
void DB2FileLoaderRegularImpl::FillParentLookup(char* dataTable)
{
int32 parentIdOffset = _loadInfo->Meta->GetParentIndexFieldOffset();
uint32 recordSize = _loadInfo->Meta->GetRecordSize();
@@ -668,11 +656,6 @@ void DB2FileLoaderRegularImpl::FillParentLookup(char* dataTable, char** indexTab
uint32 recordIndex = _parentIndexes[i][0].Entries[j].RecordIndex + recordIndexOffset;
char* recordData = &dataTable[recordIndex * recordSize];
// temporary workaround
uint32 id = GetRecord(recordIndex).GetId();
if (!indexTable[id])
continue;
switch (_loadInfo->Meta->Fields[_loadInfo->Meta->ParentIndexField].Type)
{
case FT_SHORT:
@@ -836,9 +819,6 @@ T DB2FileLoaderRegularImpl::RecordGetVarInt(uint8 const* record, uint32 field, u
EndianConvert(immediateValue);
T value;
memcpy(&value, &immediateValue, std::min(sizeof(T), sizeof(immediateValue)));
if constexpr (std::is_integral_v<T>)
if (_columnMeta[field].CompressionData.immediate.BitWidth > sizeof(T) * 8 && int64(value) != int64(immediateValue))
throw Temporary_10_0_7_metadata_bug_workaround();
return value;
}
case DB2ColumnCompression::CommonData:
@@ -1850,7 +1830,7 @@ void DB2FileLoader::LoadHeaders(DB2FileSource* source, DB2FileLoadInfo const* lo
EndianConvert(_header.SectionCount);
if (_header.Signature != 0x34434457) //'WDC4'
throw DB2FileLoadException(Trinity::StringFormat("Incorrect file signature in {}, expected 'WDC3', got %c%c%c%c", source->GetFileName(),
throw DB2FileLoadException(Trinity::StringFormat("Incorrect file signature in {}, expected 'WDC4', got {}{}{}{}", source->GetFileName(),
char(_header.Signature & 0xFF), char((_header.Signature >> 8) & 0xFF), char((_header.Signature >> 16) & 0xFF), char((_header.Signature >> 24) & 0xFF)));
if (loadInfo && _header.LayoutHash != loadInfo->Meta->LayoutHash)