Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IGNITE-9424 set partition to KeyCacheObject after reading from page #4645

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
import org.apache.ignite.lang.IgniteClosure;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.lang.IgnitePredicate;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import static org.apache.ignite.internal.pagemem.PageIdAllocator.FLAG_IDX;
Expand Down Expand Up @@ -1346,7 +1347,7 @@ private boolean canUpdateOldRow(GridCacheContext cctx, @Nullable CacheDataRow ol
@Nullable CacheDataRow oldRow) throws IgniteCheckedException {
int cacheId = grp.storeCacheIdInDataPage() ? cctx.cacheId() : CU.UNDEFINED_CACHE_ID;

DataRow dataRow = new DataRow(key, val, ver, partId, expireTime, cacheId);
DataRow dataRow = makeDataRow(key, val, ver, expireTime, cacheId);

if (canUpdateOldRow(cctx, oldRow, dataRow) && rowStore.updateRow(oldRow.link(), dataRow))
dataRow.link(oldRow.link());
Expand All @@ -1367,6 +1368,22 @@ private boolean canUpdateOldRow(GridCacheContext cctx, @Nullable CacheDataRow ol
return dataRow;
}

/**
* @param key Cache key.
* @param val Cache value.
* @param ver Version.
* @param expireTime Expired time.
* @param cacheId Cache id.
* @return Made data row.
*/
@NotNull private DataRow makeDataRow(KeyCacheObject key, CacheObject val, GridCacheVersion ver, long expireTime,
int cacheId) {
if (key.partition() == -1)
key.partition(partId);

return new DataRow(key, val, ver, partId, expireTime, cacheId);
}

/** {@inheritDoc} */
@Override public void update(
GridCacheContext cctx,
Expand All @@ -1386,10 +1403,7 @@ private boolean canUpdateOldRow(GridCacheContext cctx, @Nullable CacheDataRow ol

assert oldRow == null || oldRow.cacheId() == cacheId : oldRow;

if (key.partition() == -1)
key.partition(partId);

DataRow dataRow = new DataRow(key, val, ver, partId, expireTime, cacheId);
DataRow dataRow = makeDataRow(key, val, ver, expireTime, cacheId);

CacheObjectContext coCtx = cctx.cacheObjectContext();

Expand Down