Example #1
0
        public void AppendFile()
        {
            Placement place = new Placement(798, 1, 1, 1, UInt16.MaxValue);

            using (ServerClientSession session = new ServerClientSession(systemDir))
            {
                session.BeginUpdate();
                ObjWithArray a = new ObjWithArray(10);
                a.Persist(place, session);
                session.Commit(); // commit Database 798
            }
            place = new Placement(798, 2, 1, 100, UInt16.MaxValue);
            for (int i = 0; i < 25; i++)
            {
                using (ServerClientSession session = new ServerClientSession(systemDir))
                {
                    //session.SetTraceAllDbActivity();
                    session.BeginUpdate();
                    for (int j = 0; j < 1000; j++)
                    {
                        ObjWithArray a = new ObjWithArray(j * 10);
                        a.Persist(place, session);
                    }
                    session.FlushUpdates();
                    session.FlushUpdatesServers(); // check if this will cause file to be appended
                    Database db = session.NewDatabase(3567);
                    using (ServerClientSession session2 = new ServerClientSession(systemDir))
                    {
                        session2.BeginUpdate();
                        ObjWithArray a = new ObjWithArray(10);
                        a.Persist(place, session2);
                        session2.Commit();
                    }
                    session.Abort(); // appended page space now unused? Need tidy?
                }
            }
        }
Example #2
0
 public void ServerPageFlush()
 {
     using (ServerClientSession session = new ServerClientSession(systemDir, systemHost))
     {
         //DatabaseLocation location = new DatabaseLocation(systemHost, location2Dir, 700, UInt32.MaxValue, session, false, PageInfo.encryptionKind.noEncryption);
         Placement place = new Placement(789, 1, 1, 1);
         //session.SetTraceAllDbActivity();
         session.BeginUpdate();
         session.RegisterClass(typeof(ObjWithArray));                                                  // avoid lock failure by registrty ahead of running parallell sessions.
         session.RegisterClass(typeof(Person));                                                        // avoid lock failure by registrty ahead of running parallell sessions.
         session.RegisterClass(typeof(VelocityDbSchema.Samples.AllSupportedSample.Pet));               // avoid lock failure by registrty ahead of running parallell sessions.
         session.RegisterClass(typeof(VelocityDbList <WeakIOptimizedPersistableReference <Person> >)); // avoid lock failure by registrty ahead of running parallell sessions.
         // session.NewLocation(location);
         session.Commit();
         session.BeginUpdate();
         for (int i = 0; i < 4000; i++)
         {
             ObjWithArray person = new ObjWithArray(i * 10);
             person.Persist(place, session);
         }
         session.FlushUpdates();
         for (int i = 0; i < 1000; i++)
         {
             ObjWithArray person = new ObjWithArray(i);
             person.Persist(place, session);
         }
         using (ServerClientSession session2 = new ServerClientSession(systemDir, systemHost))
         {
             Placement place2 = new Placement(7891, 1, 1, 1);
             session2.BeginUpdate();
             for (int i = 0; i < 1000; i++)
             {
                 ObjWithArray person = new ObjWithArray(i);
                 person.Persist(place2, session2);
             }
             session2.FlushUpdates();
             for (int i = 0; i < 1000; i++)
             {
                 ObjWithArray person = new ObjWithArray(i);
                 person.Persist(place2, session2);
             }
             session2.Commit();
         }
         using (ServerClientSession session2 = new ServerClientSession(systemDir, systemHost))
         {
             Placement place2 = new Placement(7894, 1, 1, 1);
             session2.BeginUpdate();
             for (int i = 0; i < 5000; i++)
             {
                 ObjWithArray person = new ObjWithArray(i);
                 person.Persist(place2, session2);
             }
             session2.FlushUpdates();
             for (int i = 0; i < 1000; i++)
             {
                 ObjWithArray person = new ObjWithArray(i);
                 person.Persist(place2, session2);
             }
             session2.Commit();
         }
         using (ServerClientSession session2 = new ServerClientSession(systemDir, systemHost))
         {
             Placement place2 = new Placement(7897, 1, 1, 1);
             session2.BeginUpdate();
             for (int i = 0; i < 5000; i++)
             {
                 ObjWithArray person = new ObjWithArray(i);
                 person.Persist(place2, session2);
             }
             session2.FlushUpdates();
             for (int i = 0; i < 1000; i++)
             {
                 ObjWithArray person = new ObjWithArray(i);
                 person.Persist(place2, session2);
             }
             using (ServerClientSession session3 = new ServerClientSession(systemDir, systemHost))
             {
                 Placement place3 = new Placement(7900, 1, 1, 1);
                 session3.BeginUpdate();
                 for (int i = 0; i < 1000; i++)
                 {
                     ObjWithArray person = new ObjWithArray(i);
                     person.Persist(place3, session3);
                 }
                 session3.FlushUpdates();
                 for (int i = 0; i < 1000; i++)
                 {
                     ObjWithArray person = new ObjWithArray(i);
                     person.Persist(place3, session3);
                 }
                 session.Commit();
                 session2.Commit();
                 session3.Commit();
             }
         }
     }
 }