Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void concurrentFlushingWithFailuresMustNotPutInterleavedDataIntoFile()
        internal virtual void ConcurrentFlushingWithFailuresMustNotPutInterleavedDataIntoFile()
        {
            assertTimeout(ofMillis(LONG_TIMEOUT_MILLIS), () =>
            {
                RecordFormat recordFormat = new StandardRecordFormat();
                const int filePageCount   = 2_000;
                using (RandomPageCacheTestHarness harness = new RandomPageCacheTestHarness())
                {
                    harness.ConcurrencyLevel   = 16;
                    harness.UseAdversarialIO   = true;
                    harness.MischiefRate       = 0.0;
                    harness.FailureRate        = 0.5;
                    harness.ErrorRate          = 0.0;
                    harness.CachePageCount     = filePageCount / 2;
                    harness.FilePageCount      = filePageCount;
                    harness.InitialMappedFiles = 3;
                    harness.CommandCount       = 15_000;
                    harness.FileSystem         = fs;
                    harness.disableCommands(MapFile, UnmapFile, ReadRecord, ReadMulti);
                    harness.Verification = FilesAreCorrectlyWrittenVerification(recordFormat, filePageCount);

                    harness.run(LONG_TIMEOUT_MILLIS, MILLISECONDS);
                }
            });
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void concurrentPageFaultingMustNotPutInterleavedDataIntoPages()
        internal virtual void ConcurrentPageFaultingMustNotPutInterleavedDataIntoPages()
        {
            assertTimeout(ofMillis(LONG_TIMEOUT_MILLIS), () =>
            {
                const int filePageCount   = 11;
                RecordFormat recordFormat = new PageCountRecordFormat();
                using (RandomPageCacheTestHarness harness = new RandomPageCacheTestHarness())
                {
                    harness.ConcurrencyLevel   = 11;
                    harness.UseAdversarialIO   = false;
                    harness.CachePageCount     = 3;
                    harness.FilePageCount      = filePageCount;
                    harness.InitialMappedFiles = 1;
                    harness.CommandCount       = 10000;
                    harness.RecordFormat       = recordFormat;
                    harness.FileSystem         = fs;
                    harness.useProfiler(Profiler);
                    harness.disableCommands(FlushCache, FlushFile, MapFile, UnmapFile, WriteRecord, WriteMulti);
                    harness.Preparation = (cache, fs, filesTouched) =>
                    {
                        File file = filesTouched.GetEnumerator().next();
                        using (PagedFile pf = cache.map(file, cache.pageSize()), PageCursor cursor = pf.Io(0, PF_SHARED_WRITE_LOCK))
                        {
                            for (int pageId = 0; pageId < filePageCount; pageId++)
                            {
                                cursor.Next();
                                recordFormat.fillWithRecords(cursor);
                            }
                        }
                    };

                    harness.run(LONG_TIMEOUT_MILLIS, MILLISECONDS);
                }
            });
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @RepeatedTest(10) void readsAndWritesMustBeMutuallyConsistent()
        internal virtual void ReadsAndWritesMustBeMutuallyConsistent()
        {
            assertTimeout(ofMillis(SEMI_LONG_TIMEOUT_MILLIS), () =>
            {
                int filePageCount = 100;
                using (RandomPageCacheTestHarness harness = new RandomPageCacheTestHarness())
                {
                    harness.disableCommands(FlushCache, FlushFile, MapFile, UnmapFile);
                    harness.setCommandProbabilityFactor(ReadRecord, 0.5);
                    harness.setCommandProbabilityFactor(WriteRecord, 0.5);
                    harness.ConcurrencyLevel   = 8;
                    harness.FilePageCount      = filePageCount;
                    harness.InitialMappedFiles = 1;
                    harness.Verification       = FilesAreCorrectlyWrittenVerification(new StandardRecordFormat(), filePageCount);
                    harness.run(SEMI_LONG_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
                }
            });
        }