From: Bryan T. <tho...@us...> - 2007-03-29 17:01:39
|
Update of /cvsroot/cweb/bigdata/src/test/com/bigdata/scaleup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv16125/src/test/com/bigdata/scaleup Modified Files: TestMetadataIndex.java TestPartitionedJournal.java Log Message: Fixed bug in overflow handling for triple store. Added DataService UUID[] to partition metadata. Index: TestMetadataIndex.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/test/com/bigdata/scaleup/TestMetadataIndex.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** TestMetadataIndex.java 27 Mar 2007 17:11:42 -0000 1.13 --- TestMetadataIndex.java 29 Mar 2007 17:01:34 -0000 1.14 *************** *** 159,164 **** final int partId0 = 0; ! ! PartitionMetadata part1 = new PartitionMetadata(partId0); assertEquals(null,md.put(key0, part1)); --- 159,166 ---- final int partId0 = 0; ! ! final UUID[] dataServices = new UUID[]{UUID.randomUUID(),UUID.randomUUID()}; ! ! PartitionMetadata part1 = new PartitionMetadata(partId0,dataServices); assertEquals(null,md.put(key0, part1)); *************** *** 169,173 **** final UUID segmentUUID_b = UUID.randomUUID(); ! PartitionMetadata part2 = new PartitionMetadata(partId0, 1, new SegmentMetadata[] { new SegmentMetadata("a", 10L, ResourceState.Live, segmentUUID_a) }); --- 171,175 ---- final UUID segmentUUID_b = UUID.randomUUID(); ! PartitionMetadata part2 = new PartitionMetadata(partId0, dataServices, new SegmentMetadata[] { new SegmentMetadata("a", 10L, ResourceState.Live, segmentUUID_a) }); *************** *** 177,181 **** assertEquals(part2,md.get(key0)); ! PartitionMetadata part3 = new PartitionMetadata(partId0, 2, new SegmentMetadata[] { new SegmentMetadata("a", 10L, ResourceState.Live, --- 179,183 ---- assertEquals(part2,md.get(key0)); ! PartitionMetadata part3 = new PartitionMetadata(partId0, dataServices, new SegmentMetadata[] { new SegmentMetadata("a", 10L, ResourceState.Live, *************** *** 251,255 **** */ final int partId0 = 0; ! PartitionMetadata part0 = new PartitionMetadata(partId0); assertEquals(null,md.put(key0, part0)); assertEquals(part0,md.get(key0)); --- 253,258 ---- */ final int partId0 = 0; ! final UUID[] dataServices = new UUID[]{UUID.randomUUID(),UUID.randomUUID()}; ! PartitionMetadata part0 = new PartitionMetadata(partId0,dataServices); assertEquals(null,md.put(key0, part0)); assertEquals(part0,md.get(key0)); *************** *** 259,263 **** final int partId1 = 1; ! PartitionMetadata part1 = new PartitionMetadata(partId1,1, new SegmentMetadata[] { new SegmentMetadata("a", 10L,ResourceState.Live, segmentUUID_a) }); assertEquals(null,md.put(key1, part1)); --- 262,266 ---- final int partId1 = 1; ! PartitionMetadata part1 = new PartitionMetadata(partId1,dataServices, new SegmentMetadata[] { new SegmentMetadata("a", 10L,ResourceState.Live, segmentUUID_a) }); assertEquals(null,md.put(key1, part1)); *************** *** 265,269 **** final int partId2 = 2; ! PartitionMetadata part2 = new PartitionMetadata(partId2,2, new SegmentMetadata[] { new SegmentMetadata("a", 10L,ResourceState.Live, segmentUUID_a), new SegmentMetadata("b", 20L,ResourceState.Live, segmentUUID_b) }); --- 268,272 ---- final int partId2 = 2; ! PartitionMetadata part2 = new PartitionMetadata(partId2,dataServices, new SegmentMetadata[] { new SegmentMetadata("a", 10L,ResourceState.Live, segmentUUID_a), new SegmentMetadata("b", 20L,ResourceState.Live, segmentUUID_b) }); *************** *** 347,351 **** */ final int partId0 = 0; ! PartitionMetadata part0 = new PartitionMetadata(partId0); assertEquals(null,md.put(key0, part0)); assertEquals(part0,md.get(key0)); --- 350,355 ---- */ final int partId0 = 0; ! final UUID[] dataServices = new UUID[]{UUID.randomUUID(),UUID.randomUUID()}; ! PartitionMetadata part0 = new PartitionMetadata(partId0,dataServices); assertEquals(null,md.put(key0, part0)); assertEquals(part0,md.get(key0)); *************** *** 355,359 **** final int partId1 = 1; ! PartitionMetadata part1 = new PartitionMetadata(partId1,1, new SegmentMetadata[] { new SegmentMetadata("a", 10L,ResourceState.Live, segmentUUID_a) }); assertEquals(null,md.put(key1, part1)); --- 359,363 ---- final int partId1 = 1; ! PartitionMetadata part1 = new PartitionMetadata(partId1,dataServices, new SegmentMetadata[] { new SegmentMetadata("a", 10L,ResourceState.Live, segmentUUID_a) }); assertEquals(null,md.put(key1, part1)); *************** *** 361,365 **** final int partId2 = 2; ! PartitionMetadata part2 = new PartitionMetadata(partId2,2, new SegmentMetadata[] { new SegmentMetadata("a", 10L,ResourceState.Live, segmentUUID_a), new SegmentMetadata("b", 20L,ResourceState.Live, segmentUUID_b) }); --- 365,369 ---- final int partId2 = 2; ! PartitionMetadata part2 = new PartitionMetadata(partId2,dataServices, new SegmentMetadata[] { new SegmentMetadata("a", 10L,ResourceState.Live, segmentUUID_a), new SegmentMetadata("b", 20L,ResourceState.Live, segmentUUID_b) }); *************** *** 429,432 **** --- 433,438 ---- Journal store = new Journal(properties); + final UUID[] dataServices = new UUID[]{UUID.randomUUID(),UUID.randomUUID()}; + final UUID indexUUID = UUID.randomUUID(); *************** *** 438,442 **** // define a single partition with no segments. ! md.put(new byte[]{}, new PartitionMetadata(0)); // btree to be filled with data. --- 444,448 ---- // define a single partition with no segments. ! md.put(new byte[]{}, new PartitionMetadata(0,dataServices)); // btree to be filled with data. *************** *** 483,487 **** * update the metadata index for this partition. */ ! md.put(new byte[] {}, new PartitionMetadata(0, 1, new SegmentMetadata[] { new SegmentMetadata("" + outFile, outFile.length(), ResourceState.Live, --- 489,493 ---- * update the metadata index for this partition. */ ! md.put(new byte[] {}, new PartitionMetadata(0, dataServices, new SegmentMetadata[] { new SegmentMetadata("" + outFile, outFile.length(), ResourceState.Live, *************** *** 537,540 **** --- 543,548 ---- Journal store = new Journal(properties); + final UUID[] dataServices = new UUID[]{UUID.randomUUID(),UUID.randomUUID()}; + final UUID indexUUID = UUID.randomUUID(); *************** *** 546,550 **** // define a single partition with no segments. ! md.put(new byte[]{}, new PartitionMetadata(0)); // btree to be filled with data. --- 554,558 ---- // define a single partition with no segments. ! md.put(new byte[]{}, new PartitionMetadata(0,dataServices)); // btree to be filled with data. *************** *** 593,597 **** * update the metadata index for this partition. */ ! md.put(new byte[] {}, new PartitionMetadata(0, 2, new SegmentMetadata[] { new SegmentMetadata("" + outFile01, outFile01.length(), ResourceState.Live, --- 601,605 ---- * update the metadata index for this partition. */ ! md.put(new byte[] {}, new PartitionMetadata(0, dataServices, new SegmentMetadata[] { new SegmentMetadata("" + outFile01, outFile01.length(), ResourceState.Live, *************** *** 650,654 **** * has been replaced by the merged result (index segment 02). */ ! md.put(new byte[] {}, new PartitionMetadata(0, 3, new SegmentMetadata[] { new SegmentMetadata("" + outFile01, outFile01.length(), --- 658,662 ---- * has been replaced by the merged result (index segment 02). */ ! md.put(new byte[] {}, new PartitionMetadata(0, dataServices, new SegmentMetadata[] { new SegmentMetadata("" + outFile01, outFile01.length(), *************** *** 719,722 **** --- 727,732 ---- Journal store = new Journal(properties); + final UUID[] dataServices = new UUID[]{UUID.randomUUID(),UUID.randomUUID()}; + final UUID indexUUID = UUID.randomUUID(); *************** *** 728,732 **** // define a single partition with no segments. ! md.put(new byte[]{}, new PartitionMetadata(0)); /* --- 738,742 ---- // define a single partition with no segments. ! md.put(new byte[]{}, new PartitionMetadata(0,dataServices)); /* *************** *** 869,873 **** * update the metadata index for this partition. */ ! md.put(new byte[] {}, new PartitionMetadata(0, 2, new SegmentMetadata[] { new SegmentMetadata("" + outFile01, outFile01.length(), --- 879,883 ---- * update the metadata index for this partition. */ ! md.put(new byte[] {}, new PartitionMetadata(0, dataServices, new SegmentMetadata[] { new SegmentMetadata("" + outFile01, outFile01.length(), *************** *** 934,938 **** */ PartitionMetadata oldpart = md.put(new byte[] {}, ! new PartitionMetadata(0, nextSegId++, new SegmentMetadata[] { new SegmentMetadata("" + outFile02, outFile02 --- 944,948 ---- */ PartitionMetadata oldpart = md.put(new byte[] {}, ! new PartitionMetadata(0, dataServices, new SegmentMetadata[] { new SegmentMetadata("" + outFile02, outFile02 *************** *** 958,962 **** seg.close(); ! new File(oldpart.segs[0].filename).delete(); // this is now the current index segment. --- 968,972 ---- seg.close(); ! new File(oldpart.resources[0].getFile()).delete(); // this is now the current index segment. *************** *** 985,989 **** seg.close(); ! new File(md.get(new byte[]{}).segs[0].filename).delete(); System.err.println("End of stress test: ntrial="+ntrials+", nops="+nops); --- 995,999 ---- seg.close(); ! new File(md.get(new byte[]{}).resources[0].getFile()).delete(); System.err.println("End of stress test: ntrial="+ntrials+", nops="+nops); *************** *** 1017,1020 **** --- 1027,1032 ---- Journal store = new Journal(properties); + final UUID[] dataServices = new UUID[]{UUID.randomUUID(),UUID.randomUUID()}; + final UUID indexUUID = UUID.randomUUID(); *************** *** 1026,1030 **** // define a single partition with no segments. ! md.put(new byte[]{}, new PartitionMetadata(0)); // btree to be filled with data. --- 1038,1042 ---- // define a single partition with no segments. ! md.put(new byte[]{}, new PartitionMetadata(0,dataServices)); // btree to be filled with data. *************** *** 1072,1076 **** * update the metadata index for this partition. */ ! md.put(new byte[] {}, new PartitionMetadata(0,1, new SegmentMetadata[] { new SegmentMetadata("" + outFile01, outFile01.length(),ResourceState.Live, builder1.segmentUUID) })); --- 1084,1088 ---- * update the metadata index for this partition. */ ! md.put(new byte[] {}, new PartitionMetadata(0,dataServices, new SegmentMetadata[] { new SegmentMetadata("" + outFile01, outFile01.length(),ResourceState.Live, builder1.segmentUUID) })); *************** *** 1116,1120 **** * update the metadata index for this partition. */ ! md.put(new byte[] {}, new PartitionMetadata(0, 1, new SegmentMetadata[] { new SegmentMetadata("" + outFile01, outFile01.length(), --- 1128,1132 ---- * update the metadata index for this partition. */ ! md.put(new byte[] {}, new PartitionMetadata(0, dataServices, new SegmentMetadata[] { new SegmentMetadata("" + outFile01, outFile01.length(), Index: TestPartitionedJournal.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/test/com/bigdata/scaleup/TestPartitionedJournal.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TestPartitionedJournal.java 27 Mar 2007 14:34:24 -0000 1.8 --- TestPartitionedJournal.java 29 Mar 2007 17:01:34 -0000 1.9 *************** *** 58,62 **** --- 58,64 ---- import com.bigdata.journal.Journal; import com.bigdata.objndx.AbstractBTreeTestCase; + import com.bigdata.objndx.BTree; import com.bigdata.objndx.BatchInsert; + import com.bigdata.objndx.ByteArrayValueSerializer; import com.bigdata.objndx.IIndex; import com.bigdata.objndx.KeyBuilder; *************** *** 127,134 **** /** ! * Test the ability to register and use named index, including whether the ! * named index is restart safe. */ ! public void test_registerAndUse() { Properties properties = getProperties(); --- 129,202 ---- /** ! * Test the ability to register and use a named index that does NOT support ! * transactional isolation, including whether the named index is restart ! * safe. */ ! public void test_registerAndUse_noIsolation() { ! ! Properties properties = getProperties(); ! ! properties.setProperty(Options.DELETE_ON_CLOSE, "false"); ! ! properties.setProperty(Options.BASENAME,getName()); ! ! MasterJournal journal = new MasterJournal(properties); ! ! final String name = "abc"; ! ! IIndex index = new BTree(journal, 3, UUID.randomUUID(), ByteArrayValueSerializer.INSTANCE); ! ! assertNull(journal.getIndex(name)); ! ! index = journal.registerIndex(name, index); ! ! assertTrue(journal.getIndex(name) instanceof PartitionedIndexView); ! ! assertEquals("name", name, ((PartitionedIndexView) journal.getIndex(name)) ! .getName()); ! ! MetadataIndex mdi = journal.getSlave().getMetadataIndex(name); ! ! assertEquals("mdi.entryCount", 1, mdi.getEntryCount()); ! ! final byte[] k0 = new byte[]{0}; ! final byte[] v0 = new byte[]{0}; ! ! index.insert( k0, v0); ! ! /* ! * commit and close the journal ! */ ! journal.commit(); ! ! journal.close(); ! ! if (journal.isStable()) { ! ! /* ! * re-open the journal and test restart safety. ! */ ! journal = new MasterJournal(properties); ! ! index = (PartitionedIndexView) journal.getIndex(name); ! ! assertNotNull("btree", index); ! assertEquals("entryCount", 1, ((PartitionedIndexView)index).getBTree().getEntryCount()); ! assertEquals(v0, (byte[])index.lookup(k0)); ! ! journal.dropIndex(name); ! ! journal.close(); ! ! } ! ! } ! ! /** ! * Test the ability to register and use a named index that supports ! * transactional isolation, including whether the named index is restart ! * safe. ! */ ! public void test_registerAndUse_isolation() { Properties properties = getProperties(); *************** *** 259,263 **** assertEquals("#partitions",1,mdi.getEntryCount()); ! assertEquals("#segments",0,mdi.get(new byte[]{}).segs.length); /* --- 327,331 ---- assertEquals("#partitions",1,mdi.getEntryCount()); ! assertEquals("#segments",0,mdi.get(new byte[]{}).resources.length); /* *************** *** 308,312 **** assertEquals("#partitions",1,mdi.getEntryCount()); ! assertEquals("#segments",1,mdi.get(new byte[]{}).segs.length); /* --- 376,380 ---- assertEquals("#partitions",1,mdi.getEntryCount()); ! assertEquals("#segments",1,mdi.get(new byte[]{}).resources.length); /* *************** *** 387,403 **** assertEquals("partId",0,pmd.partId); - assertEquals("nextSegId",trial+1,pmd.nextSegId); - assertEquals("#segments", 1, pmd.getLiveCount()); ! if(pmd.segs.length>1) { ! assertEquals("#segments",2,pmd.segs.length); assertEquals("state", ResourceState.Dead, ! pmd.segs[0].state); assertEquals("state", ResourceState.Live, ! pmd.segs[1].state); } --- 455,469 ---- assertEquals("partId",0,pmd.partId); assertEquals("#segments", 1, pmd.getLiveCount()); ! if(pmd.resources.length>1) { ! assertEquals("#segments",2,pmd.resources.length); assertEquals("state", ResourceState.Dead, ! pmd.resources[0].state()); assertEquals("state", ResourceState.Live, ! pmd.resources[1].state()); } |