Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issueFullFileCheck results in an infinite loop #193

Closed
zdenek-jonas opened this issue Feb 21, 2020 · 4 comments
Closed

issueFullFileCheck results in an infinite loop #193

zdenek-jonas opened this issue Feb 21, 2020 · 4 comments
Assignees

Comments

@zdenek-jonas
Copy link
Contributor

I have the following test:

    @Test
    void deleteDirectoryTest() throws IOException {
        Customer customer = CustomerGenerator.generateNewCustomer();

        Configuration configuration = Configuration.Default();

        EmbeddedStorageManager storageManager = configuration.setBaseDirectory(location.toString())
                .setDataFileMaximumSize(1024)
                .setDataFileMinimumSize(1024)
                .setDeletionDirectory(location.resolve("deleted").toString())
                .createEmbeddedStorageFoundation().createEmbeddedStorageManager(customer).start();

        for (int i =0;i<100;i++) {
            customer = CustomerGenerator.generateNewCustomer();
            storageManager.store(customer);
        }
        storageManager.issueFullFileCheck();
        storageManager.shutdown();

    }

When i call storageManager.issueFullFileCheck(), the program starts in infinite loop created files in deleted directory.

AzureAD+ZdenekJonas@CHARLOTTE MINGW64 /c
$ ls /c/Users/ZdenekJonas/AppData/Local/Temp/junit8591381328850713160/deleted/channel_0/
channel_0_1.dat     channel_0_1516.dat  channel_0_2032.dat  channel_0_2547.dat  channel_0_3062.dat  channel_0_3578.dat  channel_0_4091.dat  channel_0_4605.dat  channel_0_5119.dat  channel_0_5633.dat  channel_0_6147.dat  channel_0_6661.dat  channel_0_7175.dat
channel_0_10.dat    channel_0_1517.dat  channel_0_2033.dat  channel_0_2548.dat  channel_0_3063.dat  channel_0_3579.dat  channel_0_4092.dat  channel_0_4606.dat  channel_0_512.dat   channel_0_5634.dat  channel_0_6148.dat  channel_0_6662.dat  channel_0_7176.dat
channel_0_100.dat   channel_0_1518.dat  channel_0_2034.dat  channel_0_2549.dat  channel_0_3064.dat  channel_0_358.dat   channel_0_4093.dat  channel_0_4607.dat  channel_0_5120.dat  channel_0_5635.dat  channel_0_6149.dat  channel_0_6663.dat  channel_0_7177.dat
channel_0_1000.dat  channel_0_1519.dat  channel_0_2035.dat  channel_0_255.dat   channel_0_3065.dat  channel_0_3580.dat  channel_0_4094.dat  channel_0_4608.dat  channel_0_5121.dat  channel_0_5636.dat  channel_0_615.dat   channel_0_6664.dat  channel_0_7178.dat
channel_0_1001.dat  channel_0_152.dat   channel_0_2036.dat  channel_0_2550.dat  channel_0_3066.dat  channel_0_3581.dat  channel_0_4095.dat  channel_0_4609.dat  channel_0_5122.dat  channel_0_5637.dat  channel_0_6150.dat  channel_0_6665.dat  channel_0_7179.dat
channel_0_1002.dat  channel_0_1520.dat  channel_0_2037.dat  channel_0_2551.dat  channel_0_3067.dat  channel_0_3582.dat  channel_0_4096.dat  channel_0_461.dat   channel_0_5123.dat  channel_0_5638.dat  channel_0_6151.dat  channel_0_6666.dat  channel_0_718.dat
channel_0_1003.dat  channel_0_1521.dat  channel_0_2038.dat  channel_0_2552.dat  channel_0_3068.dat  channel_0_3583.dat  channel_0_4097.dat  channel_0_4610.dat  channel_0_5124.dat  channel_0_5639.dat  channel_0_6152.dat  channel_0_6667.dat  channel_0_7180.dat
channel_0_1004.dat  channel_0_1522.dat  channel_0_2039.dat  channel_0_2553.dat  channel_0_3069.dat  channel_0_3584.dat  channel_0_4098.dat  channel_0_4611.dat  channel_0_5125.dat  channel_0_564.dat   channel_0_6153.dat  channel_0_6668.dat  channel_0_7181.dat
channel_0_1005.dat  channel_0_1523.dat  channel_0_204.dat   channel_0_2554.dat  channel_0_307.dat   channel_0_3585.dat  channel_0_4099.dat  channel_0_4612.dat  channel_0_5126.dat  channel_0_5640.dat  channel_0_6154.dat  channel_0_6669.dat  channel_0_7182.dat
....
@tm-ms
Copy link
Contributor

tm-ms commented Feb 25, 2020

The logic causing the looping must still be fixed, but for now, I refined the min/max file size validation by adding a minimum file size range.
The exception message is for example:
For the specified file minimum size of 2000, the specified file maximum size must at least be 1024 higher (3024 in total), but it is only 2100.

These minimum values make sense, because without them, the storage management could be configured to flood the file system with a gigantic number of tiny files.

@tm-ms tm-ms self-assigned this Feb 25, 2020
@fh-ms fh-ms transferred this issue from another repository Apr 27, 2021
@zdenek-jonas
Copy link
Contributor Author

Test udpate to new Api:

  @Test
   void deleteDirectoryTest(@TempDir Path location) throws IOException {
       Customer customer = CustomerGenerator.generateNewCustomer();


       EmbeddedStorageManager storageManager = EmbeddedStorageConfigurationBuilder.New()
               .setStorageDirectory(location.toString())
               .setDataFileMaximumSize(ByteSize.New(1024, ByteUnit.B))
               .setDataFileMinimumSize(ByteSize.New(1024, ByteUnit.B))
               .setDeletionDirectory(location.resolve("deleted").toString())
               .createEmbeddedStorageFoundation().createEmbeddedStorageManager(customer).start();

       for (int i =0;i<100;i++) {
           customer = CustomerGenerator.generateNewCustomer();
           storageManager.store(customer);
       }
       storageManager.issueFullFileCheck();
       storageManager.shutdown();

   }

@hg-ms
Copy link
Contributor

hg-ms commented May 3, 2022

please retest

@zdenek-jonas
Copy link
Contributor Author

Retest successful. Issue closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants