xtern commented on a change in pull request #6951: Ignite 11073 12069 P2P Rebalance collaboration work URL: https://github.com/apache/ignite/pull/6951#discussion_r408764890
########## File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtLocalPartition.java ########## @@ -888,6 +945,31 @@ public void awaitDestroy() { } } + /** + * Re-initialize partition with a new file. + * + * @param snapshot Partition snapshot file. + * @throws IOException If was not able to move partition file. + * @throws IgniteCheckedException If cache or partition with the given ID does not exists. + */ + public void initialize(File snapshot) throws IgniteCheckedException, IOException { + assert state() == MOVING : "grp=" + group().cacheOrGroupName() + ", p=" + id + ", state=" + state(); + + FilePageStore pageStore = + ((FilePageStore)((FilePageStoreManager)ctx.pageStore()).getStore(group().groupId(), id)); + + File dest = new File(pageStore.getFileAbsolutePath()); + + assert !dest.exists() : "dest=" + dest; + + if (log.isDebugEnabled()) + log.debug("Moving snapshot [from=" + snapshot + " , to=" + dest + " , size=" + snapshot.length() + "]"); + + Files.move(snapshot.toPath(), dest.toPath()); + + store.init(); Review comment: As I described above, the current implementation covers the case only when the GridCacheDataStore was not initialized. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services