Skip to content

Commit

Permalink
IGNITE-14823 Manager abbrevation (#11142)
Browse files Browse the repository at this point in the history
  • Loading branch information
nizhikov authored Dec 26, 2023
1 parent 941061f commit df6bd46
Show file tree
Hide file tree
Showing 18 changed files with 58 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,11 @@ protected static class TestTree extends BPlusTree<Long, Long> {

/** */
private static PageLockTrackerManager mockPageLockTrackerManager() {
PageLockTrackerManager manager = mock(PageLockTrackerManager.class);
PageLockTrackerManager mgr = mock(PageLockTrackerManager.class);

when(manager.createPageLockTracker(anyString())).thenReturn(PageLockTrackerManager.NOOP_LSNR);
when(mgr.createPageLockTracker(anyString())).thenReturn(PageLockTrackerManager.NOOP_LSNR);

return manager;
return mgr;
}
}

Expand Down
2 changes: 1 addition & 1 deletion modules/checkstyle/src/main/resources/abbrevations.csv
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ label,lbl
#local,loc
logger,log
loader,ldr
#manager,mgr
manager,mgr
#message,msg
#mutex,mux
#network,net
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,9 @@ private Ignite prepareGridForTest() throws Exception {
private File indexPartition(Ignite ig, String groupName) {
IgniteEx ig0 = (IgniteEx)ig;

FilePageStoreManager pageStoreManager = ((FilePageStoreManager)ig0.context().cache().context().pageStore());
FilePageStoreManager pageStoreMgr = ((FilePageStoreManager)ig0.context().cache().context().pageStore());

return new File(pageStoreManager.cacheWorkDir(true, groupName), INDEX_FILE_NAME);
return new File(pageStoreMgr.cacheWorkDir(true, groupName), INDEX_FILE_NAME);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,9 @@ protected void removeClosedManager(CacheManager mgr) {

if (fut != null && fut.isDone() && !fut.isFailed()) {
try {
CacheManager cachedManager = fut.get();
CacheManager cachedMgr = fut.get();

if (cachedManager == mgr)
if (cachedMgr == mgr)
uriMap.remove(mgr.getURI());
}
catch (IgniteCheckedException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2543,7 +2543,7 @@ private RestoreLogicalState applyLogicalUpdates(
RestoreLogicalState restoreLogicalState =
new RestoreLogicalState(status, it, lastArchivedSegment, cacheGroupsPredicate, partitionRecoveryStates);

final IgniteTxManager txManager = cctx.tm();
final IgniteTxManager txMgr = cctx.tm();

try {
while (restoreLogicalState.hasNext()) {
Expand All @@ -2557,7 +2557,7 @@ private RestoreLogicalState applyLogicalUpdates(
if (restoreMeta) { // Also restore tx states.
TxRecord txRec = (TxRecord)rec;

txManager.collectTxStates(txRec);
txMgr.collectTxStates(txRec);
}

break;
Expand Down Expand Up @@ -2607,7 +2607,7 @@ private RestoreLogicalState applyLogicalUpdates(
for (int i = 0; i < entryCnt; i++) {
DataEntry dataEntry = dataRec.get(i);

if (!restoreMeta && txManager.uncommitedTx(dataEntry))
if (!restoreMeta && txMgr.uncommitedTx(dataEntry))
continue;

int cacheId = dataEntry.cacheId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple

RootPage reuseListRoot = metas.reuseListRoot;

GridCacheDatabaseSharedManager dbSharedManager = (GridCacheDatabaseSharedManager)ctx.database();
GridCacheDatabaseSharedManager dbSharedMgr = (GridCacheDatabaseSharedManager)ctx.database();

pageListCacheLimit = dbSharedManager.pageListCacheLimitHolder(grp.dataRegion());
pageListCacheLimit = dbSharedMgr.pageListCacheLimitHolder(grp.dataRegion());

reuseList = new ReuseListImpl(
grp.groupId(),
Expand Down Expand Up @@ -224,7 +224,7 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
ctx.diagnostic().pageLockTracker()
);

dbSharedManager.addCheckpointListener(this, grp.dataRegion());
dbSharedMgr.addCheckpointListener(this, grp.dataRegion());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,12 +378,12 @@ private long txHoldingLockNum() {
* Count total number of locked keys on local node.
*/
private long txLockedKeysNum() {
GridCacheMvccManager mvccManager = gridKernalCtx.cache().context().mvcc();
GridCacheMvccManager mvccMgr = gridKernalCtx.cache().context().mvcc();

if (mvccManager == null)
if (mvccMgr == null)
return 0;

return mvccManager.lockedKeys().size() + mvccManager.nearLockedKeys().size();
return mvccMgr.lockedKeys().size() + mvccMgr.nearLockedKeys().size();
}

/** {@inheritDoc} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ public void initLoggerMock() {
*/
@Test
public void collisionResolutionDisabledMessageShouldBeLoggedAtInfoLevel() throws Exception {
GridCollisionManager manager = new GridCollisionManager(collisionResolutionDisabledContext());
GridCollisionManager mgr = new GridCollisionManager(collisionResolutionDisabledContext());

manager.start();
mgr.start();

verify(logger).info("Collision resolution is disabled (all jobs will be activated upon arrival).");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ public void testTxContentionMetric() throws Exception {

final Integer backKey = backupKey(cache);

IgniteTransactions txMgr = cl.transactions();
IgniteTransactions cliTxMgr = cl.transactions();

CountDownLatch blockOnce = new CountDownLatch(1);

Expand All @@ -577,7 +577,7 @@ public void testTxContentionMetric() throws Exception {
}

IgniteInternalFuture f = GridTestUtils.runAsync(() -> {
try (Transaction tx = txMgr.txStart(PESSIMISTIC, READ_COMMITTED)) {
try (Transaction tx = cliTxMgr.txStart(PESSIMISTIC, READ_COMMITTED)) {
cache0.put(priKeys.get(0), 0);
cache0.put(priKeys.get(2), 0);
tx.commit();
Expand All @@ -590,7 +590,7 @@ public void testTxContentionMetric() throws Exception {

for (int i = 0; i < contCnt; ++i) {
IgniteInternalFuture f0 = GridTestUtils.runAsync(() -> {
try (Transaction tx = txMgr.txStart(PESSIMISTIC, READ_COMMITTED)) {
try (Transaction tx = cliTxMgr.txStart(PESSIMISTIC, READ_COMMITTED)) {
cache0.put(priKeys.get(0), 0);
cache0.put(priKeys.get(1), 0);

Expand All @@ -601,7 +601,7 @@ public void testTxContentionMetric() throws Exception {
txLatch.countDown();
}

try (Transaction tx = txMgr.txStart(PESSIMISTIC, READ_COMMITTED)) {
try (Transaction tx = cliTxMgr.txStart(PESSIMISTIC, READ_COMMITTED)) {
cache0.put(priKeys.get(2), 0);
cache0.put(backKey, 0);

Expand All @@ -627,12 +627,12 @@ public void testTxContentionMetric() throws Exception {
commSpi0.stopBlock();
}

IgniteTxManager txManager = ((IgniteEx)ig).context().cache().context().tm();
IgniteTxManager srvTxMgr = ((IgniteEx)ig).context().cache().context().tm();

assertTrue(GridTestUtils.waitForCondition(new GridAbsPredicate() {
@Override public boolean apply() {
try {
U.invoke(IgniteTxManager.class, txManager, "collectTxCollisionsInfo");
U.invoke(IgniteTxManager.class, srvTxMgr, "collectTxCollisionsInfo");
}
catch (IgniteCheckedException e) {
fail(e.toString());
Expand Down Expand Up @@ -671,7 +671,7 @@ public void testKeyCollisionsMetricDifferentTimeout() throws Exception {

Ignite cl = startGrid();

IgniteTransactions txMgr = cl.transactions();
IgniteTransactions cliTxMgr = cl.transactions();

CacheConfiguration<?, ?> dfltCacheCfg = getCacheConfiguration();

Expand Down Expand Up @@ -708,7 +708,7 @@ public void testKeyCollisionsMetricDifferentTimeout() throws Exception {
}

IgniteInternalFuture f = GridTestUtils.runAsync(() -> {
try (Transaction tx = txMgr.txStart(PESSIMISTIC, READ_COMMITTED)) {
try (Transaction tx = cliTxMgr.txStart(PESSIMISTIC, READ_COMMITTED)) {
cache0.put(keyId, 0);
tx.commit();
}
Expand All @@ -720,7 +720,7 @@ public void testKeyCollisionsMetricDifferentTimeout() throws Exception {

for (int i = 0; i < contCnt; ++i) {
IgniteInternalFuture f0 = GridTestUtils.runAsync(() -> {
try (Transaction tx = txMgr.txStart(PESSIMISTIC, READ_COMMITTED)) {
try (Transaction tx = cliTxMgr.txStart(PESSIMISTIC, READ_COMMITTED)) {
cache0.put(keyId, 0);

tx.commit();
Expand All @@ -746,7 +746,7 @@ public void testKeyCollisionsMetricDifferentTimeout() throws Exception {

CacheMetrics localCacheMetrics = cache.localMetrics();

IgniteTxManager txManager = ((IgniteEx)ig).context().cache().context().tm();
IgniteTxManager srvTxMgr = ((IgniteEx)ig).context().cache().context().tm();

final TransactionsMXBean txMXBean1 = txMXBean(0);

Expand All @@ -762,7 +762,7 @@ public void testKeyCollisionsMetricDifferentTimeout() throws Exception {
ig.cache(cacheName).clearStatistics();

try {
U.invoke(IgniteTxManager.class, txManager, "collectTxCollisionsInfo");
U.invoke(IgniteTxManager.class, srvTxMgr, "collectTxCollisionsInfo");
}
catch (IgniteCheckedException e) {
fail(e.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -725,9 +725,9 @@ private T2<Integer, Integer> offheapKeysCount(int nodeIdx) {
private T2<Integer, Integer> offheapKeysCount(int nodeIdx, int part) throws IgniteCheckedException {
GridCacheContext ctx = ((IgniteEx)ignite(nodeIdx)).context().cache().internalCache(DEFAULT_CACHE_NAME).context();
// Swap and offheap are disabled for near cache.
IgniteCacheOffheapManager offheapManager = ctx.isNear() ? ctx.near().dht().context().offheap() : ctx.offheap();
IgniteCacheOffheapManager offheapMgr = ctx.isNear() ? ctx.near().dht().context().offheap() : ctx.offheap();
//First count entries...
int cnt = (int)offheapManager.cacheEntriesCount(ctx.cacheId(), part);
int cnt = (int)offheapMgr.cacheEntriesCount(ctx.cacheId(), part);

GridCacheAffinityManager aff = ctx.affinity();
AffinityTopologyVersion topVer = aff.affinityTopologyVersion();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,14 @@ public void testPartitionClearingNotBlockExchange() throws Exception {

forceCheckpoint();

GridCachePartitionExchangeManager exchangeManager = ig.cachex(CACHE_NAME).context().shared().exchange();
GridCachePartitionExchangeManager exchangeMgr = ig.cachex(CACHE_NAME).context().shared().exchange();

long topVer = exchangeManager.lastTopologyFuture().topologyVersion().topologyVersion();
long topVer = exchangeMgr.lastTopologyFuture().topologyVersion().topologyVersion();

startGrid(2);

// Check that exchange future is completed and version is incremented
GridDhtPartitionsExchangeFuture fut1 = exchangeManager.lastTopologyFuture();
GridDhtPartitionsExchangeFuture fut1 = exchangeMgr.lastTopologyFuture();

fut1.get();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public void testPutOpsIntoCacheWithExpirationConcurrentlyWithCheckpointCompleteS

AtomicBoolean timeoutReached = new AtomicBoolean(false);

CheckpointManager checkpointManager = U.field(ig0.context().cache().context().database(), "checkpointManager");
CheckpointManager checkpointMgr = U.field(ig0.context().cache().context().database(), "checkpointManager");

IgniteInternalFuture<?> ldrFut = runMultiThreadedAsync(() -> {
while (!timeoutReached.get()) {
Expand All @@ -271,7 +271,7 @@ public void testPutOpsIntoCacheWithExpirationConcurrentlyWithCheckpointCompleteS

IgniteInternalFuture<?> cpWriteLockUnlockFut = runAsync(() -> {
Object checkpointReadWriteLock = U.field(
checkpointManager.checkpointTimeoutLock(), "checkpointReadWriteLock"
checkpointMgr.checkpointTimeoutLock(), "checkpointReadWriteLock"
);

ReentrantReadWriteLockWithTracking lock = U.field(checkpointReadWriteLock, "checkpointLock");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public void testLightCheckpointAbleToStoreOnlyGivenDataRegion() throws Exception
DataRegion regionForCheckpoint = db.dataRegion(DFLT_DATA_REG_DEFAULT_NAME);

//and: Create light checkpoint with only one region.
LightweightCheckpointManager lightweightCheckpointManager = new LightweightCheckpointManager(
LightweightCheckpointManager lightweightCheckpointMgr = new LightweightCheckpointManager(
ctx::log,
ctx.igniteInstanceName(),
"light-test-checkpoint",
Expand All @@ -158,12 +158,12 @@ public void testLightCheckpointAbleToStoreOnlyGivenDataRegion() throws Exception
);

//and: Add checkpoint listener for DEFAULT_CACHE in order of storing the meta pages.
lightweightCheckpointManager.addCheckpointListener(
lightweightCheckpointMgr.addCheckpointListener(
(CheckpointListener)ctx.cache().cacheGroup(groupIdForCache(ignite0, DEFAULT_CACHE_NAME)).offheap(),
regionForCheckpoint
);

lightweightCheckpointManager.start();
lightweightCheckpointMgr.start();

//when: Fill the caches
for (int j = 0; j < 1024; j++) {
Expand All @@ -172,7 +172,7 @@ public void testLightCheckpointAbleToStoreOnlyGivenDataRegion() throws Exception
}

//and: Trigger and wait for the checkpoint.
lightweightCheckpointManager.forceCheckpoint("test", null)
lightweightCheckpointMgr.forceCheckpoint("test", null)
.futureFor(CheckpointState.FINISHED)
.get();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ public void test() throws Exception {

FullPageId pageId = new FullPageId(pageMem.allocatePage(cacheGroupId, 0, PageIdAllocator.FLAG_DATA), cacheGroupId);

PageLockTrackerManager pageLockTrackerManager = mock(PageLockTrackerManager.class);
PageLockTrackerManager pageLockTrackerMgr = mock(PageLockTrackerManager.class);

when(pageLockTrackerManager.createPageLockTracker(anyString())).thenReturn(PageLockTrackerManager.NOOP_LSNR);
when(pageLockTrackerMgr.createPageLockTracker(anyString())).thenReturn(PageLockTrackerManager.NOOP_LSNR);

LinkMap map = new LinkMap(cacheGroupId, groupName, pageMem, pageId.pageId(), true, pageLockTrackerManager);
LinkMap map = new LinkMap(cacheGroupId, groupName, pageMem, pageId.pageId(), true, pageLockTrackerMgr);

for (int i = 0; i < 10_000; i++)
map.put(i, i + 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ private void runKeyCollisionsMetric(TransactionConcurrency concurrency, Transact

Ignite cl = startGrid();

IgniteTransactions txMgr = cl.transactions();
IgniteTransactions cliTxMgr = cl.transactions();

IgniteCache<Integer, Integer> cache = ig.cache(DEFAULT_CACHE_NAME);

Expand Down Expand Up @@ -260,7 +260,7 @@ private void runKeyCollisionsMetric(TransactionConcurrency concurrency, Transact
}

IgniteInternalFuture f = GridTestUtils.runAsync(() -> {
try (Transaction tx = txMgr.txStart(concurrency, isolation)) {
try (Transaction tx = cliTxMgr.txStart(concurrency, isolation)) {
cache0.put(keyId, 0);
tx.commit();
}
Expand All @@ -272,7 +272,7 @@ private void runKeyCollisionsMetric(TransactionConcurrency concurrency, Transact

for (int i = 0; i < contCnt; ++i) {
IgniteInternalFuture f0 = GridTestUtils.runAsync(() -> {
try (Transaction tx = txMgr.txStart(concurrency, isolation)) {
try (Transaction tx = cliTxMgr.txStart(concurrency, isolation)) {
cache0.put(keyId, 0);

tx.commit();
Expand All @@ -296,12 +296,12 @@ private void runKeyCollisionsMetric(TransactionConcurrency concurrency, Transact
commSpi0.stopBlock();
}

IgniteTxManager txManager = ((IgniteEx)ig).context().cache().context().tm();
IgniteTxManager srvTxMgr = ((IgniteEx)ig).context().cache().context().tm();

assertTrue(GridTestUtils.waitForCondition(new GridAbsPredicate() {
@Override public boolean apply() {
try {
U.invoke(IgniteTxManager.class, txManager, "collectTxCollisionsInfo");
U.invoke(IgniteTxManager.class, srvTxMgr, "collectTxCollisionsInfo");
}
catch (IgniteCheckedException e) {
fail(e.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ public class BPlusTreeReuseSelfTest extends BPlusTreeSelfTest {
long rootId,
boolean initNew
) throws IgniteCheckedException {
PageLockTrackerManager pageLockTrackerManager = mock(PageLockTrackerManager.class);
PageLockTrackerManager pageLockTrackerMgr = mock(PageLockTrackerManager.class);

when(pageLockTrackerManager.createPageLockTracker(anyString())).thenReturn(new TestPageLockListener());
when(pageLockTrackerMgr.createPageLockTracker(anyString())).thenReturn(new TestPageLockListener());

return new TestReuseList(
cacheId,
"test",
pageMem,
rootId,
pageLockTrackerManager,
pageLockTrackerMgr,
new GridTestKernalContext(log),
initNew
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -527,9 +527,9 @@ private FreeList<CacheDataRow> createFreeList(int pageSize) throws Exception {

DataRegion dataRegion = new DataRegion(pageMem, plcCfg, regionMetrics, new NoOpPageEvictionTracker());

PageLockTrackerManager pageLockTrackerManager = mock(PageLockTrackerManager.class);
PageLockTrackerManager pageLockTrackerMgr = mock(PageLockTrackerManager.class);

when(pageLockTrackerManager.createPageLockTracker(anyString())).thenReturn(PageLockTrackerManager.NOOP_LSNR);
when(pageLockTrackerMgr.createPageLockTracker(anyString())).thenReturn(PageLockTrackerManager.NOOP_LSNR);

return new CacheFreeList(
1,
Expand All @@ -538,7 +538,7 @@ private FreeList<CacheDataRow> createFreeList(int pageSize) throws Exception {
null,
metaPageId,
true,
pageLockTrackerManager,
pageLockTrackerMgr,
new GridTestKernalContext(log),
null,
PageIdAllocator.FLAG_IDX
Expand Down
Loading

0 comments on commit df6bd46

Please sign in to comment.