Examples of SimpleEncoding


Examples of org.hornetq.tests.unit.core.journal.impl.fakes.SimpleEncoding

      updateTx(1, 1, 3, 6, 11, 14, 17);
      addTx(3, 28, 29, 30, 31, 32, 33, 34, 35);
      updateTx(3, 7, 8, 9, 10);
      deleteTx(2, 4, 5, 6, 23, 25, 27);

      EncodingSupport xid = new SimpleEncoding(10, (byte)0);

      prepare(2, xid);
      deleteTx(1, 1, 2, 11, 14, 15);
      prepare(1, xid);
      deleteTx(3, 28, 31, 32, 9);
View Full Code Here

Examples of org.hornetq.tests.unit.core.journal.impl.fakes.SimpleEncoding

      try
      {
         final int numMessages = 50050;

         SimpleEncoding data = new SimpleEncoding(1024, (byte)'j');

         long start = System.currentTimeMillis();

         int count = 0;
         double rates[] = new double[50];
View Full Code Here

Examples of org.hornetq.tests.unit.core.journal.impl.fakes.SimpleEncoding

      journal.start();

      journal.load(new ArrayList<RecordInfo>(), null, null);

      JournalImplTestUnit.log.debug("Adding data");
      SimpleEncoding data = new SimpleEncoding(700, (byte)'j');

      long start = System.currentTimeMillis();

      for (int i = 0; i < numMessages; i++)
      {
View Full Code Here

Examples of org.hornetq.tests.unit.core.journal.impl.fakes.SimpleEncoding

      {
         if (i % 10000 == 0)
         {
            System.out.println("Append " + i);
         }
         impl.appendAddRecord(i, (byte)0, new SimpleEncoding(1024, (byte)'f'), false);
      }

      impl.stop();

      factory = new AIOSequentialFileFactory(getTestDir());
View Full Code Here

Examples of org.hornetq.tests.unit.core.journal.impl.fakes.SimpleEncoding

      {
         if (i % 10000 == 0)
         {
            System.out.println("Append " + i);
         }
         impl.appendAddRecord(i, (byte)21, new SimpleEncoding(40, (byte)'f'), false);
         impl.appendUpdateRecord(i, (byte)22, new SimpleEncoding(40, (byte)'g'), false);
      }

      impl.stop();

      factory = new AIOSequentialFileFactory(getTestDir());
View Full Code Here

Examples of org.hornetq.tests.unit.core.journal.impl.fakes.SimpleEncoding

      commit(10);

      addTx(11, 12, 13);

      EncodingSupport xid = new SimpleEncoding(10, (byte)0);
      prepare(11, xid);

      stopJournal();

      exportImportJournal();
View Full Code Here

Examples of org.hornetq.tests.unit.core.journal.impl.fakes.SimpleEncoding

      startCompact();

      addTx(1, 2);

      prepare(1, new SimpleEncoding(10, (byte)0));

      finishCompact();

      stopJournal();
View Full Code Here

Examples of org.hornetq.tests.unit.core.journal.impl.fakes.SimpleEncoding

      load();

      addTx(1, 2);

      prepare(1, new SimpleEncoding(10, (byte)0));

      stopJournal();

      createJournal();
View Full Code Here

Examples of org.hornetq.tests.unit.core.journal.impl.fakes.SimpleEncoding

      load();

      addTx(1, 2, 3);

      prepare(1, new SimpleEncoding(10, (byte)0));

      startCompact();

      commit(1);
View Full Code Here

Examples of org.hornetq.tests.unit.core.journal.impl.fakes.SimpleEncoding

            long recordID = idGenerator.generateID();
            addTx(transactionID, recordID);
            updateTx(transactionID, recordID);
            if (preXA)
            {
               prepare(transactionID, new SimpleEncoding(10, (byte)0));
            }
            transactedRecords.add(new Pair<Long, Long>(transactionID++, recordID));
         }
      }

      if (regularAdd)
      {
         for (int i = 0; i < NIOJournalCompactTest.NUMBER_OF_RECORDS; i++)
         {
            if (!(i % 10 == 0))
            {
               delete(i);
            }
            else
            {
               liveIDs.add((long)i);
            }
         }
      }

      journal.forceMoveNextFile();

      Thread t = new Thread()
      {
         @Override
         public void run()
         {
            try
            {
               journal.testCompact();
            }
            catch (Exception e)
            {
               e.printStackTrace();
            }
         }
      };

      t.start();

      latchDone.await();

      int nextID = NIOJournalCompactTest.NUMBER_OF_RECORDS;

      if (performAppend)
      {
         for (int i = 0; i < 50; i++)
         {
            add(nextID++);
            if (i % 10 == 0)
            {
               journal.forceMoveNextFile();
            }
         }

         for (int i = 0; i < 50; i++)
         {
            // A Total new transaction (that was created after the compact started) to add new record while compacting
            // is still working
            addTx(transactionID, nextID++);
            commit(transactionID++);
            if (i % 10 == 0)
            {
               journal.forceMoveNextFile();
            }
         }
      }

      if (performUpdate)
      {
         int count = 0;
         for (Long liveID : liveIDs)
         {
            if (count++ % 2 == 0)
            {
               update(liveID);
            }
            else
            {
               // A Total new transaction (that was created after the compact started) to update a record that is being
               // compacted
               updateTx(transactionID, liveID);
               commit(transactionID++);
            }
         }
      }

      if (performDelete)
      {
         int count = 0;
         for (long liveID : liveIDs)
         {
            if (count++ % 2 == 0)
            {
               System.out.println("Deleting no trans " + liveID);
               delete(liveID);
            }
            else
            {
               System.out.println("Deleting TX " + liveID);
               // A Total new transaction (that was created after the compact started) to delete a record that is being
               // compacted
               deleteTx(transactionID, liveID);
               commit(transactionID++);
            }

            System.out.println("Deletes are going into " + ((JournalImpl)journal).getCurrentFile());
         }
      }

      if (performNonTransactionalDelete)
      {
         for (long liveID : liveIDs)
         {
            delete(liveID);
         }
      }

      if (pendingTransactions && !delayCommit)
      {
         for (Pair<Long, Long> tx : transactedRecords)
         {
            if (postXA)
            {
               prepare(tx.getA(), new SimpleEncoding(10, (byte)0));
            }
            if (tx.getA() % 2 == 0)
            {
               commit(tx.getA());

               if (deleteTransactRecords)
               {
                  delete(tx.getB());
               }
            }
            else
            {
               rollback(tx.getA());
            }
         }
      }

      /** Some independent adds and updates */
      for (int i = 0; i < 1000; i++)
      {
         long id = idGenerator.generateID();
         add(id);
         delete(id);

         if (i % 100 == 0)
         {
            journal.forceMoveNextFile();
         }
      }
      journal.forceMoveNextFile();

      latchWait.countDown();

      t.join();

      if (pendingTransactions && delayCommit)
      {
         for (Pair<Long, Long> tx : transactedRecords)
         {
            if (postXA)
            {
               prepare(tx.getA(), new SimpleEncoding(10, (byte)0));
            }
            if (tx.getA() % 2 == 0)
            {
               commit(tx.getA());

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.