private void checkPreload() throws Exception {
  assert cacheMode == PARTITIONED;
  startUp();
  Collection<IgfsFile> files=write();
  Map<UUID,Integer> expSizes=new HashMap<>(GRID_CNT,1.0f);
  for (  IgfsFile file : files) {
    for (    IgfsBlock block : file.blocks()) {
      Collection<UUID> ids=primaryOrBackups(block.key());
      for (      UUID id : ids) {
        if (expSizes.get(id) == null)         expSizes.put(id,block.length());
 else         expSizes.put(id,expSizes.get(id) + block.length());
      }
    }
  }
  info("Size map before node start: " + expSizes);
  for (int i=0; i < GRID_CNT; i++) {
    UUID id=grid(i).localNode().id();
    GridCacheAdapter<IgfsBlockKey,byte[]> cache=cache(id);
    int expSize=expSizes.get(id) != null ? expSizes.get(id) : 0;
    assertEquals(expSize,cache.igfsDataSpaceUsed());
  }
  Ignite g=startGrid(GRID_CNT);
  info("Started grid: " + g.cluster().localNode().id());
  awaitPartitionMapExchange();
  expSizes.clear();
  for (  IgfsFile file : files) {
    for (    IgfsBlock block : file.blocks()) {
      Collection<UUID> ids=primaryOrBackups(block.key());
      assert !ids.isEmpty();
      for (      UUID id : ids) {
        if (expSizes.get(id) == null)         expSizes.put(id,block.length());
 else         expSizes.put(id,expSizes.get(id) + block.length());
      }
    }
  }
  info("Size map after node start: " + expSizes);
  for (int i=0; i < GRID_CNT - 1; i++) {
    UUID id=grid(i).localNode().id();
    GridCacheAdapter<IgfsBlockKey,byte[]> cache=cache(id);
    int expSize=expSizes.get(id) != null ? expSizes.get(id) : 0;
    assertEquals("For node: " + id,expSize,cache.igfsDataSpaceUsed());
  }
}

private void checkPreload ( ) throws Exception { assert cacheMode == PARTITIONED ; startUp ( ) ; Collection < IgfsFile > files = write ( ) ; Map < UUID , Integer > expSizes = new HashMap < > ( GRID_CNT , 1.0f ) ; for ( IgfsFile file : files ) { for ( IgfsBlock block : file . blocks ( ) ) { Collection < UUID > ids = primaryOrBackups ( block . key ( ) ) ; for ( UUID id : ids ) { if ( expSizes . get ( id ) == null ) expSizes . put ( id , block . length ( ) ) ; else expSizes . put ( id , expSizes . get ( id ) + block . length ( ) ) ; } } } info ( "Size map before node start: " + expSizes ) ; for ( int i = 0 ; i < GRID_CNT ; i ++ ) { UUID id = grid ( i ) . localNode ( ) . id ( ) ; GridCacheAdapter < IgfsBlockKey , byte [ ] > cache = cache ( id ) ; int expSize = expSizes . get ( id ) != null ? expSizes . get ( id ) : 0 ; assertEquals ( expSize , cache . igfsDataSpaceUsed ( ) ) ; } Ignite g = startGrid ( GRID_CNT ) ; info ( "Started grid: " + g . cluster ( ) . localNode ( ) . id ( ) ) ; awaitPartitionMapExchange ( ) ; expSizes . clear ( ) ; for ( IgfsFile file : files ) { for ( IgfsBlock block : file . blocks ( ) ) { Collection < UUID > ids = primaryOrBackups ( block . key ( ) ) ; assert ! ids . isEmpty ( ) ; for ( UUID id : ids ) { if ( expSizes . get ( id ) == null ) expSizes . put ( id , block . length ( ) ) ; else expSizes . put ( id , expSizes . get ( id ) + block . length ( ) ) ; } } } info ( "Size map after node start: " + expSizes ) ; for ( int i = 0 ; i < GRID_CNT - 1 ; i ++ ) { UUID id = grid ( i ) . localNode ( ) . id ( ) ; GridCacheAdapter < IgfsBlockKey , byte [ ] > cache = cache ( id ) ; int expSize = expSizes . get ( id ) != null ? expSizes . get ( id ) : 0 ; assertEquals ( "For node: " + id , expSize , cache . igfsDataSpaceUsed ( ) ) ; } }
ensure that igfs size is correctly updated in case of preloading .
