Beispiel #1
0
        public void TestStats()
        {
            testName = "TestStats";
            testHome = testFixtureHome + "/" + testName;
            string dbFileName = testHome + "/" +
                                testName + ".db";

            Configuration.ClearDir(testHome);

            QueueDatabaseConfig dbConfig =
                new QueueDatabaseConfig();

            ConfigCase1(dbConfig);
            QueueDatabase db = QueueDatabase.Open(dbFileName, dbConfig);

            QueueStats stats = db.Stats();

            ConfirmStatsPart1Case1(stats);
            db.PrintFastStats(true);

            // Put 500 records into the database.
            PutRecordCase1(db, null);

            stats = db.Stats();
            ConfirmStatsPart2Case1(stats);
            db.PrintFastStats();

            db.Close();
        }
Beispiel #2
0
        public void TestStats()
        {
            testName = "TestStats";
            SetUpTest(true);
            string dbFileName = testHome + "/" +
                                testName + ".db";

            QueueDatabaseConfig dbConfig =
                new QueueDatabaseConfig();

            ConfigCase1(dbConfig);
            QueueDatabase db = QueueDatabase.Open(dbFileName, dbConfig);

            QueueStats stats = db.Stats();

            ConfirmStatsPart1Case1(stats);
            db.Msgfile = testHome + "/" + testName + ".log";
            db.PrintFastStats(true);

            // Put 500 records into the database.
            PutRecordCase1(db, null);

            stats = db.Stats();
            ConfirmStatsPart2Case1(stats);
            db.PrintFastStats();

            db.Close();
        }
Beispiel #3
0
        public void StatsInTxn(string home, string name, bool ifIsolation)
        {
            DatabaseEnvironmentConfig envConfig =
                new DatabaseEnvironmentConfig();

            EnvConfigCase1(envConfig);
            DatabaseEnvironment env = DatabaseEnvironment.Open(
                home, envConfig);

            Transaction         openTxn  = env.BeginTransaction();
            QueueDatabaseConfig dbConfig =
                new QueueDatabaseConfig();

            ConfigCase1(dbConfig);
            dbConfig.Env = env;
            QueueDatabase db = QueueDatabase.Open(name + ".db",
                                                  dbConfig, openTxn);

            openTxn.Commit();

            Transaction statsTxn = env.BeginTransaction();
            QueueStats  stats;

            if (ifIsolation == false)
            {
                stats = db.Stats(statsTxn);
            }
            else
            {
                stats = db.Stats(statsTxn, Isolation.DEGREE_ONE);
            }

            ConfirmStatsPart1Case1(stats);
            db.Msgfile = home + "/" + name + ".log";
            db.PrintStats(true);

            // Put 500 records into the database.
            PutRecordCase1(db, statsTxn);

            if (ifIsolation == false)
            {
                stats = db.Stats(statsTxn);
            }
            else
            {
                stats = db.Stats(statsTxn, Isolation.DEGREE_TWO);
            }
            ConfirmStatsPart2Case1(stats);
            db.PrintStats();

            statsTxn.Commit();
            db.Close();
            env.Close();
        }