示例#1
1
  @Test
  public void test_2GB_over() throws IOException {
    Assume.assumeTrue(CC.FULL_TEST);

    byte[] data = new byte[51111];
    int dataHash = Arrays.hashCode(data);

    Set<Long> recids = new TreeSet<Long>();

    for (int i = 0; i < 1e5; i++) {
      long recid = engine.recordPut(data, Serializer.BYTE_ARRAY_SERIALIZER);
      recids.add(recid);

      //            if(i%10000==0){
      //            System.out.println(recid);
      //            for(Long l:recids){
      //                byte[] b = engine.recordGet(l, Serializer.BYTE_ARRAY_SERIALIZER);
      //                int hash = Arrays.hashCode(b);
      //                assertEquals(l,dataHash, hash);
      //            }
      //            }

    }

    engine.commit();

    for (Long l : recids) {
      byte[] b = engine.recordGet(l, Serializer.BYTE_ARRAY_SERIALIZER);
      int hash = Arrays.hashCode(b);
      assertEquals(dataHash, hash);
    }
  }
示例#2
0
  @Test
  public void test_store_reopen_over_2GB() {
    Assume.assumeTrue(CC.FULL_TEST);

    byte[] data = new byte[11111];
    final long max = Volume.BUF_SIZE * 2L / data.length;
    final int hash = Arrays.hashCode(data);

    List<Long> recids = new ArrayList<Long>();

    for (int i = 0; i < max; i++) {
      long recid = engine.recordPut(data, Serializer.BYTE_ARRAY_SERIALIZER);
      recids.add(recid);
    }

    reopenStore();

    for (long recid : recids) {
      byte[] b = engine.recordGet(recid, Serializer.BYTE_ARRAY_SERIALIZER);
      assertEquals(hash, Arrays.hashCode(b));
    }
  }