Skip to content

Commit 6178f00

Browse files
authored
IGNITE-22799 Add partition ID to BplusTree names to make debugging easier (#4126)
1 parent 36b119e commit 6178f00

File tree

17 files changed

+54
-31
lines changed

17 files changed

+54
-31
lines changed

modules/page-memory/src/integrationTest/java/org/apache/ignite/internal/pagememory/tree/AbstractBplusTreeReusePageMemoryTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public TestReuseList(
8888
long metaPageId,
8989
boolean initNew
9090
) throws IgniteInternalCheckedException {
91-
super(grpId, partId, name, pageMem, lockLsnr, metaPageId, initNew, null, IoStatisticsHolderNoOp.INSTANCE);
91+
super(name, grpId, partId, pageMem, lockLsnr, metaPageId, initNew, null, IoStatisticsHolderNoOp.INSTANCE);
9292
}
9393

9494
static boolean checkNoLocks() {

modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/datastructure/DataStructure.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,13 @@ public abstract class DataStructure implements ManuallyCloseable {
6161
protected final int grpId;
6262

6363
/** Group name. */
64-
protected final String grpName;
64+
protected final @Nullable String grpName;
6565

6666
/** Page memory. */
6767
protected final PageMemory pageMem;
6868

6969
/** Reuse list. */
70-
@Nullable
71-
protected ReuseList reuseList;
70+
protected @Nullable ReuseList reuseList;
7271

7372
/** Default flag value for allocated pages. One of {@link PageIdAllocator#FLAG_DATA} or {@link PageIdAllocator#FLAG_AUX}. */
7473
protected final byte defaultPageFlag;
@@ -79,7 +78,7 @@ public abstract class DataStructure implements ManuallyCloseable {
7978
/**
8079
* Constructor.
8180
*
82-
* @param name Structure name (for debugging purposes).
81+
* @param structureNamePrefix Structure name prefix (for debugging purposes).
8382
* @param grpId Group ID.
8483
* @param grpName Group name.
8584
* @param partId Partition ID.
@@ -89,19 +88,19 @@ public abstract class DataStructure implements ManuallyCloseable {
8988
* PageIdAllocator#FLAG_AUX}.
9089
*/
9190
public DataStructure(
92-
String name,
91+
String structureNamePrefix,
9392
int grpId,
9493
@Nullable String grpName,
9594
int partId,
9695
PageMemory pageMem,
9796
PageLockListener lockLsnr,
9897
byte defaultPageFlag
9998
) {
100-
assert !StringUtils.nullOrEmpty(name);
99+
assert !StringUtils.nullOrEmpty(structureNamePrefix);
101100
assert pageMem != null;
102101
assert partId >= 0 && partId <= MAX_PARTITION_ID : partId;
103102

104-
this.name = name;
103+
this.name = structureNamePrefix + "_" + grpId + "_" + partId;
105104
this.grpId = grpId;
106105
this.grpName = grpName;
107106
this.partId = partId;

modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/freelist/FreeListImpl.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ public Long run(
327327
/**
328328
* Constructor.
329329
*
330+
* @param freeListNamePrefix Free list name prefix (for debugging purposes).
330331
* @param grpId Group ID.
331332
* @param partId Partition ID.
332333
* @param pageMem Page memory.
@@ -337,9 +338,9 @@ public Long run(
337338
* @throws IgniteInternalCheckedException If failed.
338339
*/
339340
public FreeListImpl(
341+
String freeListNamePrefix,
340342
int grpId,
341343
int partId,
342-
String name,
343344
PageMemory pageMem,
344345
PageLockListener lockLsnr,
345346
long metaPageId,
@@ -348,7 +349,7 @@ public FreeListImpl(
348349
IoStatisticsHolder statHolder
349350
) throws IgniteInternalCheckedException {
350351
super(
351-
name,
352+
freeListNamePrefix,
352353
grpId,
353354
partId,
354355
pageMem,

modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/freelist/PagesList.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public Boolean run(
179179
/**
180180
* Constructor.
181181
*
182-
* @param name Structure name (for debug purpose).
182+
* @param pageListNamePrefix Structure name prefix (for debugging purposes).
183183
* @param grpId Group ID.
184184
* @param partId Partition ID.
185185
* @param pageMem Page memory.
@@ -189,7 +189,7 @@ public Boolean run(
189189
* @param metaPageId Metadata page ID.
190190
*/
191191
protected PagesList(
192-
String name,
192+
String pageListNamePrefix,
193193
int grpId,
194194
int partId,
195195
PageMemory pageMem,
@@ -198,7 +198,7 @@ protected PagesList(
198198
int buckets,
199199
long metaPageId
200200
) {
201-
super(name, grpId, null, partId, pageMem, lockLsnr, FLAG_AUX);
201+
super(pageListNamePrefix, grpId, null, partId, pageMem, lockLsnr, FLAG_AUX);
202202

203203
this.log = log;
204204

modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/tree/BplusTree.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ public Bool run(
906906
/**
907907
* Constructor.
908908
*
909-
* @param name Tree name.
909+
* @param treeNamePrefix Tree name prefix (for debugging purposes).
910910
* @param grpId Group ID.
911911
* @param grpName Group name.
912912
* @param partId Partition ID.
@@ -920,7 +920,7 @@ public Bool run(
920920
* @param metaIos Meta IO versions.
921921
*/
922922
protected BplusTree(
923-
String name,
923+
String treeNamePrefix,
924924
int grpId,
925925
@Nullable String grpName,
926926
int partId,
@@ -933,15 +933,15 @@ protected BplusTree(
933933
IoVersions<? extends BplusLeafIo<L>> leafIos,
934934
IoVersions<? extends BplusMetaIo> metaIos
935935
) {
936-
this(name, grpId, grpName, partId, pageMem, lockLsnr, globalRmvId, metaPageId, reuseList);
936+
this(treeNamePrefix, grpId, grpName, partId, pageMem, lockLsnr, globalRmvId, metaPageId, reuseList);
937937

938938
setIos(innerIos, leafIos, metaIos);
939939
}
940940

941941
/**
942942
* Constructor.
943943
*
944-
* @param name Tree name.
944+
* @param treeNamePrefix Tree name prefix (for debugging purposes).
945945
* @param grpId Group ID.
946946
* @param grpName Group name.
947947
* @param pageMem Page memory.
@@ -951,7 +951,7 @@ protected BplusTree(
951951
* @param reuseList Reuse list.
952952
*/
953953
protected BplusTree(
954-
String name,
954+
String treeNamePrefix,
955955
int grpId,
956956
@Nullable String grpName,
957957
int partId,
@@ -961,7 +961,7 @@ protected BplusTree(
961961
long metaPageId,
962962
@Nullable ReuseList reuseList
963963
) {
964-
super(name, grpId, grpName, partId, pageMem, lockLsnr, FLAG_AUX);
964+
super(treeNamePrefix, grpId, grpName, partId, pageMem, lockLsnr, FLAG_AUX);
965965

966966
// TODO: IGNITE-16350 Move to config.
967967
minFill = 0.0f; // Testing worst case when merge happens only on empty page.

modules/page-memory/src/test/java/org/apache/ignite/internal/pagememory/freelist/FreeListImplTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,8 @@ private FreeList createFreeList(int pageSize) throws Exception {
143143
long metaPageId = pageMemory.allocatePageNoReuse(1, 1, FLAG_DATA);
144144

145145
return new FreeListImpl(
146-
0,
146+
"TestFreeList", 0,
147147
1,
148-
"TestFreeList",
149148
pageMemory,
150149
PageLockListenerNoOp.INSTANCE,
151150
metaPageId,

modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/PersistentPageMemoryTableStorage.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,8 @@ private FreeListImpl createFreeList(
172172
}
173173

174174
return new FreeListImpl(
175-
getTableId(),
175+
String.format(FREE_LIST_NAME, getTableId(), partId), getTableId(),
176176
partId,
177-
String.format(FREE_LIST_NAME, getTableId(), partId),
178177
dataRegion.pageMemory(),
179178
PageLockListenerNoOp.INSTANCE,
180179
meta.freeListRootPageId(),

modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/VolatilePageMemoryDataRegion.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ private FreeListImpl createFreeList(PageMemory pageMemory) throws IgniteInternal
9090
long metaPageId = pageMemory.allocatePageNoReuse(FREE_LIST_GROUP_ID, FREE_LIST_PARTITION_ID, FLAG_AUX);
9191

9292
return new FreeListImpl(
93+
FREE_LIST_NAME,
9394
FREE_LIST_GROUP_ID,
9495
FREE_LIST_PARTITION_ID,
95-
FREE_LIST_NAME,
9696
pageMemory,
9797
PageLockListenerNoOp.INSTANCE,
9898
metaPageId,

modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/index/hash/HashIndexRow.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import org.apache.ignite.internal.storage.RowId;
2121
import org.apache.ignite.internal.storage.index.IndexRow;
2222
import org.apache.ignite.internal.storage.pagememory.index.freelist.IndexColumns;
23+
import org.apache.ignite.internal.tostring.S;
2324
import org.apache.ignite.internal.util.HashUtils;
2425

2526
/**
@@ -58,4 +59,9 @@ public HashIndexRow(int indexColumnsHash, IndexColumns indexColumns, RowId rowId
5859
public RowId rowId() {
5960
return rowId;
6061
}
62+
63+
@Override
64+
public String toString() {
65+
return S.toString(HashIndexRow.class, this, super.toString());
66+
}
6167
}

modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/index/hash/HashIndexRowKey.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import org.apache.ignite.internal.storage.pagememory.index.common.IndexRowKey;
2121
import org.apache.ignite.internal.storage.pagememory.index.freelist.IndexColumns;
22+
import org.apache.ignite.internal.tostring.S;
2223

2324
/**
2425
* Key to search for a {@link HashIndexRow} in the {@link HashIndexTree}.
@@ -51,4 +52,9 @@ public int indexColumnsHash() {
5152
public IndexColumns indexColumns() {
5253
return indexColumns;
5354
}
55+
56+
@Override
57+
public String toString() {
58+
return S.toString(HashIndexRowKey.class, this);
59+
}
5460
}

modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/index/hash/HashIndexTree.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ private HashIndexTree(
6868
long metaPageId,
6969
@Nullable ReuseList reuseList
7070
) throws IgniteInternalCheckedException {
71-
super("HashIndexTree_" + grpId, grpId, grpName, partId, pageMem, lockLsnr, globalRmvId, metaPageId, reuseList);
71+
super("HashIndexTree", grpId, grpName, partId, pageMem, lockLsnr, globalRmvId, metaPageId, reuseList);
7272

7373
this.inlineSize = readInlineSizeFromMetaIo();
7474
this.dataPageReader = new DataPageReader(pageMem, grpId, statisticsHolder());
@@ -101,7 +101,7 @@ private HashIndexTree(
101101
@Nullable ReuseList reuseList,
102102
StorageHashIndexDescriptor indexDescriptor
103103
) throws IgniteInternalCheckedException {
104-
super("HashIndexTree_" + grpId, grpId, grpName, partId, pageMem, lockLsnr, globalRmvId, metaPageId, reuseList);
104+
super("HashIndexTree", grpId, grpName, partId, pageMem, lockLsnr, globalRmvId, metaPageId, reuseList);
105105

106106
this.inlineSize = binaryTupleInlineSize(pageSize(), ITEM_SIZE_WITHOUT_COLUMNS, indexDescriptor);
107107
this.dataPageReader = new DataPageReader(pageMem, grpId, statisticsHolder());

modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/index/meta/IndexMetaKey.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

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

20+
import org.apache.ignite.internal.tostring.S;
21+
2022
/**
2123
* Index meta key.
2224
*/
@@ -57,4 +59,9 @@ public boolean equals(Object o) {
5759
public int hashCode() {
5860
return indexId;
5961
}
62+
63+
@Override
64+
public String toString() {
65+
return S.toString(this);
66+
}
6067
}

modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/index/meta/IndexMetaTree.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public IndexMetaTree(
5959
@Nullable ReuseList reuseList,
6060
boolean initNew
6161
) throws IgniteInternalCheckedException {
62-
super("IndexMetaTree_" + grpId, grpId, grpName, partId, pageMem, lockLsnr, globalRmvId, metaPageId, reuseList);
62+
super("IndexMetaTree", grpId, grpName, partId, pageMem, lockLsnr, globalRmvId, metaPageId, reuseList);
6363

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

modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/index/sorted/SortedIndexRow.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import org.apache.ignite.internal.storage.RowId;
2121
import org.apache.ignite.internal.storage.index.IndexRow;
2222
import org.apache.ignite.internal.storage.pagememory.index.freelist.IndexColumns;
23+
import org.apache.ignite.internal.tostring.S;
2324

2425
/**
2526
* {@link IndexRow} implementation used in the {@link SortedIndexTree}.
@@ -46,4 +47,9 @@ public SortedIndexRow(IndexColumns indexColumns, RowId rowId) {
4647
public RowId rowId() {
4748
return rowId;
4849
}
50+
51+
@Override
52+
public String toString() {
53+
return S.toString(this);
54+
}
4955
}

modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/index/sorted/SortedIndexTree.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ private SortedIndexTree(
8282
StorageSortedIndexDescriptor indexDescriptor,
8383
boolean initNew
8484
) throws IgniteInternalCheckedException {
85-
super("SortedIndexTree_" + grpId, grpId, grpName, partId, pageMem, lockLsnr, globalRmvId, metaPageId, reuseList);
85+
super("SortedIndexTree", grpId, grpName, partId, pageMem, lockLsnr, globalRmvId, metaPageId, reuseList);
8686

8787
this.inlineSize = initNew
8888
? binaryTupleInlineSize(pageSize(), ITEM_SIZE_WITHOUT_COLUMNS, indexDescriptor)
@@ -116,7 +116,7 @@ private SortedIndexTree(
116116
long metaPageId,
117117
@Nullable ReuseList reuseList
118118
) throws IgniteInternalCheckedException {
119-
super("SortedIndexTree_" + grpId, grpId, grpName, partId, pageMem, lockLsnr, globalRmvId, metaPageId, reuseList);
119+
super("SortedIndexTree", grpId, grpName, partId, pageMem, lockLsnr, globalRmvId, metaPageId, reuseList);
120120

121121
this.inlineSize = readInlineSizeFromMetaIo();
122122
this.dataPageReader = new DataPageReader(pageMem, grpId, statisticsHolder());

modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/VersionChainTree.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public VersionChainTree(
6060
boolean initNew
6161
) throws IgniteInternalCheckedException {
6262
super(
63-
"VersionChainTree_" + grpId,
63+
"VersionChainTree",
6464
grpId,
6565
grpName,
6666
partId,

modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/mv/gc/GcQueue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public GcQueue(
6363
boolean initNew
6464
) throws IgniteInternalCheckedException {
6565
super(
66-
"GarbageCollectionTree_" + grpId,
66+
"GarbageCollectionTree",
6767
grpId,
6868
grpName,
6969
partId,

0 commit comments

Comments
 (0)