Skip to content

Commit

Permalink
IGNITE-10348 Safely recreate metastore to mitigate IGNITE-8735
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Rakov <irakov@apache.org>
  • Loading branch information
SpiderRus authored and glukos committed Dec 7, 2018
1 parent 137a0e7 commit 86f92d9
Show file tree
Hide file tree
Showing 8 changed files with 702 additions and 25 deletions.
Expand Up @@ -35,8 +35,11 @@ public interface PageIdAllocator {
/** Special partition reserved for index space. */
public static final int INDEX_PARTITION = 0xFFFF;

/** Old special partition reserved for metastore space. */
public static final int OLD_METASTORE_PARTITION = 0x0;

/** Special partition reserved for metastore space. */
public static final int METASTORE_PARTITION = 0x0;
public static final int METASTORE_PARTITION = 0x1;

/**
* Allocates a page from the space for the given partition ID and the given flags.
Expand Down
Expand Up @@ -105,6 +105,7 @@
import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager;
import org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager;
import org.apache.ignite.internal.processors.cache.persistence.freelist.FreeList;
import org.apache.ignite.internal.processors.cache.persistence.metastorage.MetaStorage;
import org.apache.ignite.internal.processors.cache.persistence.metastorage.MetastorageLifecycleListener;
import org.apache.ignite.internal.processors.cache.persistence.metastorage.ReadOnlyMetastorage;
import org.apache.ignite.internal.processors.cache.persistence.partstate.GroupPartitionId;
Expand Down Expand Up @@ -277,6 +278,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
/** Cache recovery lifecycle state and actions. */
private final CacheRecoveryLifecycle recovery = new CacheRecoveryLifecycle();

/** Tmp storage for meta migration. */
private MetaStorage.TmpStorage tmpStorage;

/**
* @param ctx Kernal context.
*/
Expand Down Expand Up @@ -5470,6 +5474,20 @@ public <T> T clone(final T obj) throws IgniteCheckedException {
});
}

/**
* Get Temporary storage
*/
public MetaStorage.TmpStorage getTmpStorage() {
return tmpStorage;
}

/**
* Set Temporary storage
*/
public void setTmpStorage(MetaStorage.TmpStorage tmpStorage) {
this.tmpStorage = tmpStorage;
}

/**
* Recovery lifecycle for caches.
*/
Expand Down
Expand Up @@ -374,10 +374,10 @@ public FilePageStoreManager(GridKernalContext ctx) {

CacheStoreHolder holder = initDir(
new File(storeWorkDir, META_STORAGE_NAME),
grpId,
1,
dataRegion.memoryMetrics(),
false);
grpId,
PageIdAllocator.METASTORE_PARTITION + 1,
dataRegion.memoryMetrics(),
false);

CacheStoreHolder old = idxCacheStores.put(grpId, holder);

Expand Down

0 comments on commit 86f92d9

Please sign in to comment.