Skip to content

Commit

Permalink
IGNITE-22799 Add partition ID to BplusTree names to make debugging ea…
Browse files Browse the repository at this point in the history
…sier (#4126)
  • Loading branch information
tkalkirill authored Jul 24, 2024
1 parent 36b119e commit 6178f00
Show file tree
Hide file tree
Showing 17 changed files with 54 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public TestReuseList(
long metaPageId,
boolean initNew
) throws IgniteInternalCheckedException {
super(grpId, partId, name, pageMem, lockLsnr, metaPageId, initNew, null, IoStatisticsHolderNoOp.INSTANCE);
super(name, grpId, partId, pageMem, lockLsnr, metaPageId, initNew, null, IoStatisticsHolderNoOp.INSTANCE);
}

static boolean checkNoLocks() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,13 @@ public abstract class DataStructure implements ManuallyCloseable {
protected final int grpId;

/** Group name. */
protected final String grpName;
protected final @Nullable String grpName;

/** Page memory. */
protected final PageMemory pageMem;

/** Reuse list. */
@Nullable
protected ReuseList reuseList;
protected @Nullable ReuseList reuseList;

/** Default flag value for allocated pages. One of {@link PageIdAllocator#FLAG_DATA} or {@link PageIdAllocator#FLAG_AUX}. */
protected final byte defaultPageFlag;
Expand All @@ -79,7 +78,7 @@ public abstract class DataStructure implements ManuallyCloseable {
/**
* Constructor.
*
* @param name Structure name (for debugging purposes).
* @param structureNamePrefix Structure name prefix (for debugging purposes).
* @param grpId Group ID.
* @param grpName Group name.
* @param partId Partition ID.
Expand All @@ -89,19 +88,19 @@ public abstract class DataStructure implements ManuallyCloseable {
* PageIdAllocator#FLAG_AUX}.
*/
public DataStructure(
String name,
String structureNamePrefix,
int grpId,
@Nullable String grpName,
int partId,
PageMemory pageMem,
PageLockListener lockLsnr,
byte defaultPageFlag
) {
assert !StringUtils.nullOrEmpty(name);
assert !StringUtils.nullOrEmpty(structureNamePrefix);
assert pageMem != null;
assert partId >= 0 && partId <= MAX_PARTITION_ID : partId;

this.name = name;
this.name = structureNamePrefix + "_" + grpId + "_" + partId;
this.grpId = grpId;
this.grpName = grpName;
this.partId = partId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ public Long run(
/**
* Constructor.
*
* @param freeListNamePrefix Free list name prefix (for debugging purposes).
* @param grpId Group ID.
* @param partId Partition ID.
* @param pageMem Page memory.
Expand All @@ -337,9 +338,9 @@ public Long run(
* @throws IgniteInternalCheckedException If failed.
*/
public FreeListImpl(
String freeListNamePrefix,
int grpId,
int partId,
String name,
PageMemory pageMem,
PageLockListener lockLsnr,
long metaPageId,
Expand All @@ -348,7 +349,7 @@ public FreeListImpl(
IoStatisticsHolder statHolder
) throws IgniteInternalCheckedException {
super(
name,
freeListNamePrefix,
grpId,
partId,
pageMem,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public Boolean run(
/**
* Constructor.
*
* @param name Structure name (for debug purpose).
* @param pageListNamePrefix Structure name prefix (for debugging purposes).
* @param grpId Group ID.
* @param partId Partition ID.
* @param pageMem Page memory.
Expand All @@ -189,7 +189,7 @@ public Boolean run(
* @param metaPageId Metadata page ID.
*/
protected PagesList(
String name,
String pageListNamePrefix,
int grpId,
int partId,
PageMemory pageMem,
Expand All @@ -198,7 +198,7 @@ protected PagesList(
int buckets,
long metaPageId
) {
super(name, grpId, null, partId, pageMem, lockLsnr, FLAG_AUX);
super(pageListNamePrefix, grpId, null, partId, pageMem, lockLsnr, FLAG_AUX);

this.log = log;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ public Bool run(
/**
* Constructor.
*
* @param name Tree name.
* @param treeNamePrefix Tree name prefix (for debugging purposes).
* @param grpId Group ID.
* @param grpName Group name.
* @param partId Partition ID.
Expand All @@ -920,7 +920,7 @@ public Bool run(
* @param metaIos Meta IO versions.
*/
protected BplusTree(
String name,
String treeNamePrefix,
int grpId,
@Nullable String grpName,
int partId,
Expand All @@ -933,15 +933,15 @@ protected BplusTree(
IoVersions<? extends BplusLeafIo<L>> leafIos,
IoVersions<? extends BplusMetaIo> metaIos
) {
this(name, grpId, grpName, partId, pageMem, lockLsnr, globalRmvId, metaPageId, reuseList);
this(treeNamePrefix, grpId, grpName, partId, pageMem, lockLsnr, globalRmvId, metaPageId, reuseList);

setIos(innerIos, leafIos, metaIos);
}

/**
* Constructor.
*
* @param name Tree name.
* @param treeNamePrefix Tree name prefix (for debugging purposes).
* @param grpId Group ID.
* @param grpName Group name.
* @param pageMem Page memory.
Expand All @@ -951,7 +951,7 @@ protected BplusTree(
* @param reuseList Reuse list.
*/
protected BplusTree(
String name,
String treeNamePrefix,
int grpId,
@Nullable String grpName,
int partId,
Expand All @@ -961,7 +961,7 @@ protected BplusTree(
long metaPageId,
@Nullable ReuseList reuseList
) {
super(name, grpId, grpName, partId, pageMem, lockLsnr, FLAG_AUX);
super(treeNamePrefix, grpId, grpName, partId, pageMem, lockLsnr, FLAG_AUX);

// TODO: IGNITE-16350 Move to config.
minFill = 0.0f; // Testing worst case when merge happens only on empty page.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,8 @@ private FreeList createFreeList(int pageSize) throws Exception {
long metaPageId = pageMemory.allocatePageNoReuse(1, 1, FLAG_DATA);

return new FreeListImpl(
0,
"TestFreeList", 0,
1,
"TestFreeList",
pageMemory,
PageLockListenerNoOp.INSTANCE,
metaPageId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,8 @@ private FreeListImpl createFreeList(
}

return new FreeListImpl(
getTableId(),
String.format(FREE_LIST_NAME, getTableId(), partId), getTableId(),
partId,
String.format(FREE_LIST_NAME, getTableId(), partId),
dataRegion.pageMemory(),
PageLockListenerNoOp.INSTANCE,
meta.freeListRootPageId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ private FreeListImpl createFreeList(PageMemory pageMemory) throws IgniteInternal
long metaPageId = pageMemory.allocatePageNoReuse(FREE_LIST_GROUP_ID, FREE_LIST_PARTITION_ID, FLAG_AUX);

return new FreeListImpl(
FREE_LIST_NAME,
FREE_LIST_GROUP_ID,
FREE_LIST_PARTITION_ID,
FREE_LIST_NAME,
pageMemory,
PageLockListenerNoOp.INSTANCE,
metaPageId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.apache.ignite.internal.storage.RowId;
import org.apache.ignite.internal.storage.index.IndexRow;
import org.apache.ignite.internal.storage.pagememory.index.freelist.IndexColumns;
import org.apache.ignite.internal.tostring.S;
import org.apache.ignite.internal.util.HashUtils;

/**
Expand Down Expand Up @@ -58,4 +59,9 @@ public HashIndexRow(int indexColumnsHash, IndexColumns indexColumns, RowId rowId
public RowId rowId() {
return rowId;
}

@Override
public String toString() {
return S.toString(HashIndexRow.class, this, super.toString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import org.apache.ignite.internal.storage.pagememory.index.common.IndexRowKey;
import org.apache.ignite.internal.storage.pagememory.index.freelist.IndexColumns;
import org.apache.ignite.internal.tostring.S;

/**
* Key to search for a {@link HashIndexRow} in the {@link HashIndexTree}.
Expand Down Expand Up @@ -51,4 +52,9 @@ public int indexColumnsHash() {
public IndexColumns indexColumns() {
return indexColumns;
}

@Override
public String toString() {
return S.toString(HashIndexRowKey.class, this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private HashIndexTree(
long metaPageId,
@Nullable ReuseList reuseList
) throws IgniteInternalCheckedException {
super("HashIndexTree_" + grpId, grpId, grpName, partId, pageMem, lockLsnr, globalRmvId, metaPageId, reuseList);
super("HashIndexTree", grpId, grpName, partId, pageMem, lockLsnr, globalRmvId, metaPageId, reuseList);

this.inlineSize = readInlineSizeFromMetaIo();
this.dataPageReader = new DataPageReader(pageMem, grpId, statisticsHolder());
Expand Down Expand Up @@ -101,7 +101,7 @@ private HashIndexTree(
@Nullable ReuseList reuseList,
StorageHashIndexDescriptor indexDescriptor
) throws IgniteInternalCheckedException {
super("HashIndexTree_" + grpId, grpId, grpName, partId, pageMem, lockLsnr, globalRmvId, metaPageId, reuseList);
super("HashIndexTree", grpId, grpName, partId, pageMem, lockLsnr, globalRmvId, metaPageId, reuseList);

this.inlineSize = binaryTupleInlineSize(pageSize(), ITEM_SIZE_WITHOUT_COLUMNS, indexDescriptor);
this.dataPageReader = new DataPageReader(pageMem, grpId, statisticsHolder());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package org.apache.ignite.internal.storage.pagememory.index.meta;

import org.apache.ignite.internal.tostring.S;

/**
* Index meta key.
*/
Expand Down Expand Up @@ -57,4 +59,9 @@ public boolean equals(Object o) {
public int hashCode() {
return indexId;
}

@Override
public String toString() {
return S.toString(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public IndexMetaTree(
@Nullable ReuseList reuseList,
boolean initNew
) throws IgniteInternalCheckedException {
super("IndexMetaTree_" + grpId, grpId, grpName, partId, pageMem, lockLsnr, globalRmvId, metaPageId, reuseList);
super("IndexMetaTree", grpId, grpName, partId, pageMem, lockLsnr, globalRmvId, metaPageId, reuseList);

setIos(IndexMetaInnerIo.VERSIONS, IndexMetaLeafIo.VERSIONS, IndexMetaTreeMetaIo.VERSIONS);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.apache.ignite.internal.storage.RowId;
import org.apache.ignite.internal.storage.index.IndexRow;
import org.apache.ignite.internal.storage.pagememory.index.freelist.IndexColumns;
import org.apache.ignite.internal.tostring.S;

/**
* {@link IndexRow} implementation used in the {@link SortedIndexTree}.
Expand All @@ -46,4 +47,9 @@ public SortedIndexRow(IndexColumns indexColumns, RowId rowId) {
public RowId rowId() {
return rowId;
}

@Override
public String toString() {
return S.toString(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private SortedIndexTree(
StorageSortedIndexDescriptor indexDescriptor,
boolean initNew
) throws IgniteInternalCheckedException {
super("SortedIndexTree_" + grpId, grpId, grpName, partId, pageMem, lockLsnr, globalRmvId, metaPageId, reuseList);
super("SortedIndexTree", grpId, grpName, partId, pageMem, lockLsnr, globalRmvId, metaPageId, reuseList);

this.inlineSize = initNew
? binaryTupleInlineSize(pageSize(), ITEM_SIZE_WITHOUT_COLUMNS, indexDescriptor)
Expand Down Expand Up @@ -116,7 +116,7 @@ private SortedIndexTree(
long metaPageId,
@Nullable ReuseList reuseList
) throws IgniteInternalCheckedException {
super("SortedIndexTree_" + grpId, grpId, grpName, partId, pageMem, lockLsnr, globalRmvId, metaPageId, reuseList);
super("SortedIndexTree", grpId, grpName, partId, pageMem, lockLsnr, globalRmvId, metaPageId, reuseList);

this.inlineSize = readInlineSizeFromMetaIo();
this.dataPageReader = new DataPageReader(pageMem, grpId, statisticsHolder());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public VersionChainTree(
boolean initNew
) throws IgniteInternalCheckedException {
super(
"VersionChainTree_" + grpId,
"VersionChainTree",
grpId,
grpName,
partId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public GcQueue(
boolean initNew
) throws IgniteInternalCheckedException {
super(
"GarbageCollectionTree_" + grpId,
"GarbageCollectionTree",
grpId,
grpName,
partId,
Expand Down

0 comments on commit 6178f00

Please sign in to comment.