[Joafip-svn] SF.net SVN: joafip:[3163] trunk/joafip
Brought to you by:
luc_peuvrier
|
From: <luc...@us...> - 2012-11-28 12:15:18
|
Revision: 3163
http://joafip.svn.sourceforge.net/joafip/?rev=3163&view=rev
Author: luc_peuvrier
Date: 2012-11-28 12:15:05 +0000 (Wed, 28 Nov 2012)
Log Message:
-----------
red black tree management changed. foreground garbage sweep changed
Modified Paths:
--------------
trunk/joafip/pom.xml
trunk/joafip/src/main/java/net/sf/joafip/store/service/AbstractStoreDelegatingToDataManager.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/StoreGarbager.java
trunk/joafip/src/main/java/net/sf/joafip/util/PersistantDataRecordIdentifierSet.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/TestLinkManagementInFile.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/TestObjectReferenceLinkInFile.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/TestStoreWithG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/garbage/GarbageDataIntegrityChecker.java
Added Paths:
-----------
trunk/joafip/src/test/java/net/sf/joafip/util/TestPersistantDataRecordIdentifierSetIteration.java
Modified: trunk/joafip/pom.xml
===================================================================
--- trunk/joafip/pom.xml 2012-11-23 03:36:47 UTC (rev 3162)
+++ trunk/joafip/pom.xml 2012-11-28 12:15:05 UTC (rev 3163)
@@ -54,6 +54,13 @@
<dependency>
<groupId>net.sf.joafip</groupId>
+ <artifactId>joafip-kvstore</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>net.sf.joafip</groupId>
<artifactId>joafip-heapfile</artifactId>
</dependency>
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/AbstractStoreDelegatingToDataManager.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/AbstractStoreDelegatingToDataManager.java 2012-11-23 03:36:47 UTC (rev 3162)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/AbstractStoreDelegatingToDataManager.java 2012-11-28 12:15:05 UTC (rev 3163)
@@ -39,10 +39,10 @@
protected final JoafipLogger logger = JoafipLogger.getLogger(getClass());// NOPMD
/** name of the data file in directory path */
- private static final String STORE_DATA =
+ public static final String STORE_DATA =
/**/"store.data";
- private static final String TRACE_FILE =
+ public static final String TRACE_FILE =
/**/"trace.txt";
/** name of the backup data file in directory path */
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/StoreGarbager.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/StoreGarbager.java 2012-11-23 03:36:47 UTC (rev 3162)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/garbage/StoreGarbager.java 2012-11-28 12:15:05 UTC (rev 3163)
@@ -97,7 +97,7 @@
private LinkRecordManager linkRecordManager;;
- //private LinkManager linkManager;
+ // private LinkManager linkManager;
public StoreGarbager(final IStoreForGarbage store) throws StoreException {
super();
@@ -110,10 +110,10 @@
public void setStoreSaver(final IStoreSaverForGarbage storeSaver) {
this.storeSaver = storeSaver;
LinkManager linkManager = storeSaver.getLinkManager();
- if( linkManager==null) {
- linkRecordManager=null;
+ if (linkManager == null) {
+ linkRecordManager = null;
} else {
- linkRecordManager=linkManager.getLinkRecordManager();
+ linkRecordManager = linkManager.getLinkRecordManager();
}
}
@@ -193,7 +193,6 @@
* @throws StoreClassNotFoundException
* @throws StoreDataCorruptedException
*/
- // FIXMELUC ____________garbageSweep
public int garbageSweep(final String filePath) throws StoreException,
StoreClassNotFoundException, StoreDataCorruptedException {
numberOFGarbaged = 0;
@@ -230,6 +229,12 @@
}
final IHeapDataManager dataManager = storeSaver.getDataManager();
+ if (LOGGER.isInfoEnabled()) {
+ final int numberOfDataRecord = dataManager
+ .getNumberOfDataRecord();
+ LOGGER.info("total number of data record " + numberOfDataRecord
+ + ", " + toPreserveSet.size() + " to preserve");
+ }
final Iterator<DataRecordIdentifier> iterator = dataManager
.dataRecordIterator();
garbageStartNotify();
@@ -240,14 +245,15 @@
if (linkRecordManager == null) {
dataManager.deleteDataRecord(existing);
} else {
- linkRecordManager.removeLinkIfExist(existing/*referenced*/);
+ linkRecordManager
+ .removeLinkIfExist(existing/* referenced */);
final ObjectLinkTreeNode objectLinkTreeNode = objectIOManager
.getObjectLinkTreeNode(existing);
dataManager.deleteDataRecord(existing);
final DataRecordIdentifier[] referencedList = objectLinkTreeNode
.getReferencedList();
for (DataRecordIdentifier referenced : referencedList) {
- removeLink(existing/*referencing*/, referenced);
+ removeLink(existing/* referencing */, referenced);
}
}
numberOFGarbaged++;
@@ -256,6 +262,9 @@
storeSaver.performModificationDone();
}
storeSaver.saveModification();
+ if (LOGGER.isInfoEnabled()) {
+ LOGGER.info("end of garbage sweep");
+ }
} catch (GarbageException exception) {
throw new StoreException(exception);
@@ -285,9 +294,11 @@
}
private void removeLink(final DataRecordIdentifier referencing,
- final DataRecordIdentifier referenced) throws GarbageException, ReferenceLinkGarbageException {
- final ReferenceLink referenceLink = linkRecordManager.searchByReferenced(referenced);
- if( referenceLink!=null) {
+ final DataRecordIdentifier referenced) throws GarbageException,
+ ReferenceLinkGarbageException {
+ final ReferenceLink referenceLink = linkRecordManager
+ .searchByReferenced(referenced);
+ if (referenceLink != null) {
referenceLink.decrementLinkCount(referencing);
linkRecordManager.updateReferenceLink(referenceLink);
}
Modified: trunk/joafip/src/main/java/net/sf/joafip/util/PersistantDataRecordIdentifierSet.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/util/PersistantDataRecordIdentifierSet.java 2012-11-23 03:36:47 UTC (rev 3162)
+++ trunk/joafip/src/main/java/net/sf/joafip/util/PersistantDataRecordIdentifierSet.java 2012-11-28 12:15:05 UTC (rev 3163)
@@ -43,7 +43,7 @@
public class PersistantDataRecordIdentifierSet extends
AbstractSet<DataRecordIdentifier> {
- private static final int MAX_RECORDS = 1000;
+ private static final int MAX_RECORDS = 10000;
private static final byte[] DATA = new byte[0];
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/TestLinkManagementInFile.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/TestLinkManagementInFile.java 2012-11-23 03:36:47 UTC (rev 3162)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/TestLinkManagementInFile.java 2012-11-28 12:15:05 UTC (rev 3163)
@@ -44,6 +44,7 @@
super.setUp();
store = new StoreForTest(1, null,
TestConstant.getWinRamDiskRuntimeDir(), true/* garbage */);
+ store.addToNotCheckMethod(net.sf.joafip.store.service.objectfortest.Bob1.class);
dataManager = store.getDataManager();
linkRecordManager = store.getLinkRecordManager();
store.openAndNewAccessSession(true/* removeFiles */);
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/TestObjectReferenceLinkInFile.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/TestObjectReferenceLinkInFile.java 2012-11-23 03:36:47 UTC (rev 3162)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/TestObjectReferenceLinkInFile.java 2012-11-28 12:15:05 UTC (rev 3163)
@@ -44,6 +44,7 @@
super.setUp();
store = new StoreForTest(1, null,
TestConstant.getWinRamDiskRuntimeDir(), true/* garbage */);
+ store.addToNotCheckMethod(net.sf.joafip.store.service.objectfortest.Bob1.class);
store.openAndNewAccessSession(true/* remove file */);
objectIOManager = store.getObjectIOManager();
dataManager = store.getDataManager();
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/TestStoreWithG.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/TestStoreWithG.java 2012-11-23 03:36:47 UTC (rev 3162)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/TestStoreWithG.java 2012-11-28 12:15:05 UTC (rev 3163)
@@ -26,6 +26,7 @@
StoreClassNotFoundException {
store = new StoreForTest(1, null, path,
/**/true/* manage garbage */);
+ store.addToNotCheckMethod(net.sf.joafip.store.service.objectfortest.Bob1.class);
store.openAndNewAccessSession(removeFiles);
dataManager = store.getDataManager();
}
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/garbage/GarbageDataIntegrityChecker.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/garbage/GarbageDataIntegrityChecker.java 2012-11-23 03:36:47 UTC (rev 3162)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/garbage/GarbageDataIntegrityChecker.java 2012-11-28 12:15:05 UTC (rev 3163)
@@ -133,12 +133,6 @@
final DataRecordIdentifier referencingDataRecordIdentifier = referencing
.getDataRecordIdentifier();
- // FIXMELUC ____________________referencing not exists
- // TestCase.assertTrue(referencingDataRecordIdentifier
- // + " referencing " + referencedDataRecordIdentifier
- // + " not in storage", dataManager
- // .hasDataRecord(referencingDataRecordIdentifier));
-
final int linkCount = referencing.getLinkCount();
referenceLinkGraphFromLinkInfo.addReferencing(
referencedDataRecordIdentifier,
Added: trunk/joafip/src/test/java/net/sf/joafip/util/TestPersistantDataRecordIdentifierSetIteration.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/util/TestPersistantDataRecordIdentifierSetIteration.java (rev 0)
+++ trunk/joafip/src/test/java/net/sf/joafip/util/TestPersistantDataRecordIdentifierSetIteration.java 2012-11-28 12:15:05 UTC (rev 3163)
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2012 Luc Peuvrier
+ * All rights reserved.
+ *
+ * This file is a part of JOAFIP.
+ *
+ * JOAFIP is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License.
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE
+ * Licensed under the LGPL License, Version 3, 29 June 2007 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * JOAFIP is distributed in the hope that it will be useful, but
+ * unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.joafip.util;
+
+import java.util.Iterator;
+
+import net.sf.joafip.AbstractJoafipCommonTestCase;
+import net.sf.joafip.NoStorableAccess;
+import net.sf.joafip.NotStorableClass;
+import net.sf.joafip.TestException;
+import net.sf.joafip.kvstore.record.entity.DataRecordIdentifier;
+
+/**
+ *
+ * @author luc peuvrier
+ *
+ */
+@NotStorableClass
+@NoStorableAccess
+public class TestPersistantDataRecordIdentifierSetIteration extends AbstractJoafipCommonTestCase {
+
+ private PersistantDataRecordIdentifierSet set;
+
+ public TestPersistantDataRecordIdentifierSetIteration()
+ throws TestException {
+ super();
+ }
+
+ public TestPersistantDataRecordIdentifierSetIteration(final String name)
+ throws TestException {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ set = new PersistantDataRecordIdentifierSet("runtime/set");
+ set.startService(true);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ try {
+ set.clear();
+ } catch (Exception exception) {
+ // ignore error
+ }
+ try {
+ set.stopService(true);
+ } catch (Exception exception) {
+ // ignore error
+ }
+ super.tearDown();
+ }
+
+ public void testIteration() {
+ for(long value=0;value<50000;value++){
+ set.add(new DataRecordIdentifier(value));
+ }
+ final Iterator<DataRecordIdentifier> iterator = set.iterator();
+ long value=0;
+ while(iterator.hasNext()){
+ final DataRecordIdentifier dataRecordIdentifier = iterator.next();
+ assertEquals("bad value",value,dataRecordIdentifier.value);
+ value++;
+ }
+ assertEquals("bad value",50000L,value);
+ }
+}
Property changes on: trunk/joafip/src/test/java/net/sf/joafip/util/TestPersistantDataRecordIdentifierSetIteration.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|