Skip to content

IndexFile only 19999999 Indexes can be stored, not 20000000 Indexes  #1141

@ph3636

Description

@ph3636

1.describe :

class IndexHeader attribute indexCount initial value is 1 not 0,so index pos not begin 0 but begin 1,therefore IndexFile only 19999999 Indexes can be stored, not 20000000 Indexes

  1. What did you see instead?
    class IndexHeader attribute indexCount as follows :
    private AtomicInteger indexCount = new AtomicInteger(1);
    Original code as follows :
    int absIndexPos = IndexHeader.INDEX_HEADER_SIZE + this.hashSlotNum * hashSlotSize
    + this.indexHeader.getIndexCount() * indexSize;
    this.mappedByteBuffer.putInt(absIndexPos, keyHash);
    this.mappedByteBuffer.putLong(absIndexPos + 4, phyOffset);
    this.mappedByteBuffer.putInt(absIndexPos + 4 + 8, (int) timeDiff);
    this.mappedByteBuffer.putInt(absIndexPos + 4 + 8 + 4, slotValue);
    this.mappedByteBuffer.putInt(absSlotPos, this.indexHeader.getIndexCount());

  2. What did you expect to see?

class IndexHeader attribute indexCount as follows :
private AtomicInteger indexCount = new AtomicInteger(0);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions