[Mulgara-svn] r700 - in branches/mgr-89-backup: jxdata/iTQL/backup_restore src/jar/resolver/java/org/mulgara/resolver src/jar/store-stringpool-memory/java/org/mulgara/store/stringpool/memory
andrae at mulgara.org
andrae at mulgara.org
Thu Mar 20 11:55:34 UTC 2008
Author: andrae
Date: 2008-03-20 04:55:33 -0700 (Thu, 20 Mar 2008)
New Revision: 700
Modified:
branches/mgr-89-backup/jxdata/iTQL/backup_restore/test.jxu
branches/mgr-89-backup/src/jar/resolver/java/org/mulgara/resolver/BackupOperation.java
branches/mgr-89-backup/src/jar/store-stringpool-memory/java/org/mulgara/store/stringpool/memory/MemoryStringPoolImpl.java
Log:
refs #89
This fixes the Backup issues, but in the process makes the backups incompatible
with Restore.
The issue is that the StringPoolSession does some absolute/relative mapping on
URI's that isn't done when working directly against the StringPool. This
operation has to be reversed in the Restore, and as Restore also by passes the
transaction (this isn't an issue as it *has* to hold the write-lock anyway) this
reversal isn't happening.
Note that fixing Restore to do the reversal will be incompatible with any prior
backups, so is unacceptable without upgrading the backup version number.
This suggests that we need to provide alternative functions on StringPoolSession
that are dedicated to providing mapping free operations.
Modified: branches/mgr-89-backup/jxdata/iTQL/backup_restore/test.jxu
===================================================================
--- branches/mgr-89-backup/jxdata/iTQL/backup_restore/test.jxu 2008-03-20 07:44:54 UTC (rev 699)
+++ branches/mgr-89-backup/jxdata/iTQL/backup_restore/test.jxu 2008-03-20 11:55:33 UTC (rev 700)
@@ -238,8 +238,6 @@
<!-- BACKUP 3 - backup and restore the server locally -->
<!-- ================================================== -->
-<!--
-
<set name="query" value="backup <@server@> to local <@baseuri@/tmp/server.gz>;"/>
<eval stepClass="org.mulgara.store.jxunit.QueryJX" />
@@ -248,6 +246,7 @@
<fail>Output failed. Check badQuery6Result.xml for output.</fail>
</ifEqual>
+<!--
<set name="query" value="restore <@server@> from local <@baseuri@/tmp/server.gz>;"/>
<eval stepClass="org.mulgara.store.jxunit.QueryJX" />
Modified: branches/mgr-89-backup/src/jar/resolver/java/org/mulgara/resolver/BackupOperation.java
===================================================================
--- branches/mgr-89-backup/src/jar/resolver/java/org/mulgara/resolver/BackupOperation.java 2008-03-20 07:44:54 UTC (rev 699)
+++ branches/mgr-89-backup/src/jar/resolver/java/org/mulgara/resolver/BackupOperation.java 2008-03-20 11:55:33 UTC (rev 700)
@@ -140,9 +140,7 @@
new GZIPOutputStream(os), "UTF-8"
));
- StringPool stringPool =
- resolverSessionFactory.getPersistentStringPool();
- backupDatabase(stringPool, systemResolver, metadata, writer);
+ backupDatabase(systemResolver, metadata, writer);
}
} finally {
// Clean up.
@@ -167,10 +165,8 @@
* @param writer Writer
* @throws Exception
*/
- private void backupDatabase(
- StringPool stringPool, Resolver resolver,
- DatabaseMetadata metadata, Writer writer
- ) throws Exception {
+ private void backupDatabase(SystemResolver systemResolver, DatabaseMetadata metadata, Writer writer)
+ throws Exception {
// Write the backup
writer.write(BACKUP_FILE_HEADER + BACKUP_VERSION + '\n');
writer.write(new Date().toString());
@@ -179,7 +175,7 @@
// Dump the strings.
writer.write("RDFNODES\n");
- Tuples t = stringPool.findGNodes(null, null);
+ Tuples t = systemResolver.findStringPoolType(null, null);
assert t != null;
try {
t.beforeFirst();
@@ -188,7 +184,7 @@
writer.write(Long.toString(localNode));
writer.write(' ');
- SPObject spObject = stringPool.findSPObject(localNode);
+ SPObject spObject = systemResolver.findStringPoolObject(localNode);
writer.write(spObject.getEncodedString());
writer.write('\n');
}
@@ -197,7 +193,7 @@
}
// Dump the triples.
- Tuples tuples = resolver.resolve(new ConstraintImpl(
+ Tuples tuples = systemResolver.resolve(new ConstraintImpl(
StatementStore.VARIABLES[0],
StatementStore.VARIABLES[1],
StatementStore.VARIABLES[2],
Modified: branches/mgr-89-backup/src/jar/store-stringpool-memory/java/org/mulgara/store/stringpool/memory/MemoryStringPoolImpl.java
===================================================================
--- branches/mgr-89-backup/src/jar/store-stringpool-memory/java/org/mulgara/store/stringpool/memory/MemoryStringPoolImpl.java 2008-03-20 07:44:54 UTC (rev 699)
+++ branches/mgr-89-backup/src/jar/store-stringpool-memory/java/org/mulgara/store/stringpool/memory/MemoryStringPoolImpl.java 2008-03-20 11:55:33 UTC (rev 700)
@@ -135,7 +135,6 @@
smallestSPObjects[s] = new SPLimit(s, true);
largestSPObjects[s] = new SPLimit(s, false);
}
-
}
//
@@ -355,7 +354,10 @@
"Finding typed literal nodes on the in memory string pool is not supported"
);
}
- SortedSet subset = stringIndex.subSet(smallestSPObjects[typeCategory.ID], largestSPObjects[typeCategory.ID]);
+
+ SortedSet subset = typeCategory != null ?
+ stringIndex.subSet(smallestSPObjects[typeCategory.ID], largestSPObjects[typeCategory.ID]) : stringIndex;
+
return new SetWrapperTuples(subset);
}
More information about the Mulgara-svn
mailing list