[ 
https://issues.apache.org/jira/browse/COUCHDB-926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12925359#action_12925359
 ] 

Russell van der Walt commented on COUCHDB-926:
----------------------------------------------

I'm not sure that it is always the case, as in my first test, only the database 
wasn't released.

The script is in C# using the Divan library, but I'm sure you'll get the gist 
of it:


            var dbname =  "storage-test";
            var server = new CouchServer("192.168.1.21");
            if (server.HasDatabase(dbname)) 
                server.DeleteDatabase(dbname);
    
            var database = server.GetNewDatabase(dbname);

            var design = database.NewDesignDocument("attached");
            design.AddView("id", @" function(doc) { if (doc.type && doc.type == 
'telemetry') { emit(doc.id, null); } }");
            database.WriteDocument(design);

            var id = Guid.NewGuid().ToString();

            using (var timer = new LoopTimer("records")) {
                var terminated = false;
                while (!terminated) {

                    var item = new {
                        id = id,
                        ownerId = Guid.Empty,
                        originId = Guid.NewGuid(),
                        linked = new Guid[] { Guid.NewGuid(), Guid.NewGuid() },
                        date = DateTime.Now.ToUniversalTime(),
                        received = DateTime.Now.ToUniversalTime(),
                        active = true,
                        status = new string[] { "ignition_on" },
                        type = "record"
                    };

                    database.TouchView("attached", "id");

                    var doc = database.GetDocument(id);
                    if (doc != null) {
                        database.SaveDocument(new 
CouchJsonDocument(Json.Encode(item), id, doc.Rev));
                    } else
                        database.SaveDocument(new 
CouchJsonDocument(Json.Encode(item), id));

                    timer.Increment();
                    terminated = Console.KeyAvailable;
                    
                }
            }

            Console.ReadKey();
            Console.WriteLine("Press any key to compact");
            Console.ReadLine();

            database.Compact(true); // compact database and views




> Compaction does not release file descriptors
> --------------------------------------------
>
>                 Key: COUCHDB-926
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-926
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Database Core
>    Affects Versions: 1.0.1
>         Environment: Ubuntu 9.04/10.4
>            Reporter: Russell van der Walt
>             Fix For: 1.0.2, 1.1
>
>
> When couch compacts a database, file descriptors of the deleted files are 
> left open, causing the freed disk space to not be released to the system. 
> With regular compaction, the system eventually runs out of disk space.
> There is a conversation thread in the user mailing list titled "Couch not 
> releasing deleted files" that gives more insight into the problem, but I have 
> been unable to find a bug report for it, so please accept my apologies if 
> this has already been dealt with.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to