private void ReOpenDb()
        {
            Db = new TFChunkDb(new TFChunkDbConfig(PathName,
                                                   new VersionedPatternFileNamingStrategy(PathName, "chunk-"),
                                                   10000,
                                                   0,
                                                   WriterCheckpoint,
                                                   ChaserCheckpoint,
                                                   new InMemoryCheckpoint(-1),
                                                   new InMemoryCheckpoint(-1)));

            Db.Open();

            TableIndex = new TableIndex(Path.Combine(PathName, "index"),
                                        () => new HashListMemTable(MaxEntriesInMemTable * 2),
                                        MaxEntriesInMemTable);
            ReadIndex = new ReadIndex(new NoopPublisher(),
                                      2,
                                      5,
                                      () => new TFChunkReader(Db, Db.Config.WriterCheckpoint),
                                      TableIndex,
                                      new ByLengthHasher(),
                                      new NoLRUCache <string, StreamCacheInfo>(),
                                      additionalCommitChecks: true,
                                      metastreamMaxCount: MetastreamMaxCount);
            ReadIndex.Init(WriterCheckpoint.Read(), ChaserCheckpoint.Read());
        }
        public void should_be_able_to_read_all_backwards()
        {
            var checkpoint = WriterCheckpoint.Read();
            var pos        = new TFPos(checkpoint, checkpoint);
            var result     = ReadIndex.ReadAllEventsBackward(pos, 10);

            Assert.AreEqual(3, result.Records.Count);
        }
Example #3
0
        public void should_be_able_to_read_all_backwards_and_get_events_before_replication_checkpoint()
        {
            var checkpoint = WriterCheckpoint.Read();
            var pos        = new TFPos(checkpoint, checkpoint);
            var result     = ReadIndex.ReadAllEventsBackward(pos, 10);

            Assert.AreEqual(2, result.Records.Count);
        }
Example #4
0
        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();

            ReadIndex.Close();
            ReadIndex.Dispose();
            TableIndex.Close(removeFiles: false);

            TableIndex = new TableIndex(GetFilePathFor("index"),
                                        () => new HashListMemTable(maxSize: MaxEntriesInMemTable * 2),
                                        maxSizeForMemory: MaxEntriesInMemTable);

            ReadIndex = new ReadIndex(new NoopPublisher(),
                                      2,
                                      2,
                                      () => new TFChunkReader(Db, WriterCheckpoint, 0),
                                      TableIndex,
                                      new ByLengthHasher(),
                                      new NoLRUCache <string, StreamCacheInfo>(),
                                      additionalCommitChecks: true,
                                      metastreamMaxCount: 1);
            ReadIndex.Init(WriterCheckpoint.Read(), ChaserCheckpoint.Read());
        }
 public void checksums_should_be_equal_to_ack_checksum()
 {
     Assert.AreEqual(TruncateCheckpoint, WriterCheckpoint.Read());
     Assert.AreEqual(TruncateCheckpoint, ChaserCheckpoint.Read());
 }
 public void checksums_should_be_equal_to_beginning_of_intersected_scavenged_chunk()
 {
     Assert.AreEqual(chunkEdge.TransactionPosition, WriterCheckpoint.Read());
     Assert.AreEqual(chunkEdge.TransactionPosition, ChaserCheckpoint.Read());
 }