Commit 45e69785 authored by Jim King's avatar Jim King Committed by Jørgen Lind
Browse files

port remainder of changes

parent 7263efa9
...@@ -3340,8 +3340,10 @@ main(int argc, char* argv[]) ...@@ -3340,8 +3340,10 @@ main(int argc, char* argv[])
for (size_t fileIndex = 0; fileIndex < segmentInfoListsSize; ++fileIndex) for (size_t fileIndex = 0; fileIndex < segmentInfoListsSize; ++fileIndex)
{ {
assert(fileInfo.IsOffsetSorted() ? chunkInfo.min[1] < gatherOffsetValues.size() : true);
const int const int
offetSortedOffsetValue = fileInfo.IsOffsetSorted() ? offsetStart + offsetStep * chunkInfo.min[1] : 0; offsetSortedOffsetValue = fileInfo.IsOffsetSorted() ? gatherOffsetValues[chunkInfo.min[1]] : 0;
if (fileInfo.IsOffsetSorted()) if (fileInfo.IsOffsetSorted())
{ {
...@@ -3349,7 +3351,7 @@ main(int argc, char* argv[]) ...@@ -3349,7 +3351,7 @@ main(int argc, char* argv[])
assert(chunkInfo.min[1] + 1 == chunkInfo.max[1]); assert(chunkInfo.min[1] + 1 == chunkInfo.max[1]);
// If the calculated offset value isn't present in this file's map then skip // If the calculated offset value isn't present in this file's map then skip
if (fileInfo.m_segmentInfoListsByOffset[fileIndex].find(offetSortedOffsetValue) == fileInfo.m_segmentInfoListsByOffset[fileIndex].end()) if (fileInfo.m_segmentInfoListsByOffset[fileIndex].find(offsetSortedOffsetValue) == fileInfo.m_segmentInfoListsByOffset[fileIndex].end())
{ {
continue; continue;
} }
...@@ -3357,7 +3359,7 @@ main(int argc, char* argv[]) ...@@ -3357,7 +3359,7 @@ main(int argc, char* argv[])
auto& auto&
segmentInfoList = fileInfo.IsOffsetSorted() segmentInfoList = fileInfo.IsOffsetSorted()
? fileInfo.m_segmentInfoListsByOffset[fileIndex][offetSortedOffsetValue] ? fileInfo.m_segmentInfoListsByOffset[fileIndex][offsetSortedOffsetValue]
: fileInfo.m_segmentInfoLists[fileIndex]; : fileInfo.m_segmentInfoLists[fileIndex];
// does this file have any segments in the primary key range? // does this file have any segments in the primary key range?
...@@ -3433,9 +3435,6 @@ main(int argc, char* argv[]) ...@@ -3433,9 +3435,6 @@ main(int argc, char* argv[])
auto &chunkInfo = chunkInfos[chunk]; auto &chunkInfo = chunkInfos[chunk];
const int
offsetSortedOffsetValue = fileInfo.IsOffsetSorted() ? offsetStart + offsetStep * chunkInfo.min[1] : 0;
// if we've crossed to a new inline then trim the trace page cache // if we've crossed to a new inline then trim the trace page cache
if (chunk > 0) if (chunk > 0)
{ {
...@@ -3529,6 +3528,11 @@ main(int argc, char* argv[]) ...@@ -3529,6 +3528,11 @@ main(int argc, char* argv[])
continue; continue;
} }
assert(fileInfo.IsOffsetSorted() ? chunkInfo.min[1] < gatherOffsetValues.size() : true);
const int
offsetSortedOffsetValue = fileInfo.IsOffsetSorted() ? gatherOffsetValues[chunkInfo.min[1]] : 0;
const auto lowerSegmentIndex = std::get<0>(result->second); const auto lowerSegmentIndex = std::get<0>(result->second);
const auto upperSegmentIndex = std::get<1>(result->second); const auto upperSegmentIndex = std::get<1>(result->second);
...@@ -3564,6 +3568,9 @@ main(int argc, char* argv[]) ...@@ -3564,6 +3568,9 @@ main(int argc, char* argv[])
tertiaryIndex = 0, tertiaryIndex = 0,
currentSecondaryKey = chunkInfo.secondaryKeyStart; currentSecondaryKey = chunkInfo.secondaryKeyStart;
auto
gatherSpacing = CalculateGatherSpacing(fileInfo, fold, gatherOffsetValues, traceDataManager, traceSpacingByOffset, firstTrace, jsonOutput);
for (int64_t trace = firstTrace; trace <= segment->m_traceStop; trace++, tertiaryIndex++) for (int64_t trace = firstTrace; trace <= segment->m_traceStop; trace++, tertiaryIndex++)
{ {
const char* header = traceDataManager.getTraceData(trace, error); const char* header = traceDataManager.getTraceData(trace, error);
...@@ -3589,6 +3596,9 @@ main(int argc, char* argv[]) ...@@ -3589,6 +3596,9 @@ main(int argc, char* argv[])
// we've progressed to a new secondary key, so reset the tertiary (gather) index // we've progressed to a new secondary key, so reset the tertiary (gather) index
currentSecondaryKey = secondaryTest; currentSecondaryKey = secondaryTest;
tertiaryIndex = 0; tertiaryIndex = 0;
// then get respace info for the next gather
gatherSpacing = CalculateGatherSpacing(fileInfo, fold, gatherOffsetValues, traceDataManager, traceSpacingByOffset, trace, jsonOutput);
} }
int int
...@@ -3613,7 +3623,7 @@ main(int argc, char* argv[]) ...@@ -3613,7 +3623,7 @@ main(int argc, char* argv[])
assert(primaryIndex >= chunkInfo.min[PrimaryKeyDimension(fileInfo)] && primaryIndex < chunkInfo.max[PrimaryKeyDimension(fileInfo)]); assert(primaryIndex >= chunkInfo.min[PrimaryKeyDimension(fileInfo)] && primaryIndex < chunkInfo.max[PrimaryKeyDimension(fileInfo)]);
assert(secondaryIndex >= chunkInfo.min[SecondaryKeyDimension(fileInfo)] && secondaryIndex < chunkInfo.max[SecondaryKeyDimension(fileInfo)]); assert(secondaryIndex >= chunkInfo.min[SecondaryKeyDimension(fileInfo)] && secondaryIndex < chunkInfo.max[SecondaryKeyDimension(fileInfo)]);
if (fileInfo.Is4D() && traceOrderByOffset) if (fileInfo.Is4D())
{ {
if (fileInfo.IsOffsetSorted()) if (fileInfo.IsOffsetSorted())
{ {
...@@ -3624,18 +3634,12 @@ main(int argc, char* argv[]) ...@@ -3624,18 +3634,12 @@ main(int argc, char* argv[])
} }
else else
{ {
if (traceOrderByOffset) tertiaryIndex = gatherSpacing->GetTertiaryIndex(trace);
// sanity check the new index
if (tertiaryIndex < 0 || tertiaryIndex >= fold)
{ {
// recalculate tertiaryIndex from header offset value continue;
const auto
thisOffset = SEGY::ReadFieldFromHeader(header, g_traceHeaderFields["offset"], fileInfo.m_headerEndianness);
tertiaryIndex = (thisOffset - offsetStart) / offsetStep;
// sanity check the new index
if (tertiaryIndex < 0 || tertiaryIndex >= fold)
{
continue;
}
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment