[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Status very long for big repository and status caching.

From: Laurent CHASTEL <lchastel_at_hotmail.com>
Date: 2004-12-15 16:10:29 CET

Hello,

I'm the "source code manager" of the firm I works for.
I have implemented a solution using SVN.
One part of our project was under CVS, I moved all to SVN a PowerBuilder
application (2500 objects) and a database (5000 objects : tables, stored
procedures, ...)
We use tools that are SCC compliants, As there was no SCC dll for SVN (the
project begins in august), I developped one.
The SCC imposed us to have all files in one folder (one for database, one
for PB)

We tried to use the solution during this week, and it's impossible to use.
We need 10 to 15 min to get the list of objects under SVN control for the
database folder and the 10 min again when performing an operation.

I have implemented the retrieve of the list by using the function
svn_wc_status.
I only want local status : is the file under SVN ? and is it locally
modified ?
The execution of this function is the longuest part of the treatment.
Did I used the good function ? (You could find the source code I write at
the end of the message)

As I have understood the reason of the execution time is due to the number
of file in the folder.
When getting the status of one file, the status of all files of the folder
is retrieve so there are lots of disk access, several for each file.
Do you have think about "caching" status in a file in work copy ?
So instead of having several access to several files, we have only one file
to access 2 times for each actions :
one at the beginning of the commands (read the file) and one when the action
is done (write the file)

The server :
svn 1.1.1 (source archive) under linux redhat entreprise 3 (HP hardware).
Repository in FSFS
The client :
svn 1.1.1 under windows (same version as server)
Visual Studio .NET 2003
Computer : Celeron 1.8Ghz, 256 Mo RAM

Best regards,
Laurent

PS : For those who are interreted, I have the same idea than TortoiseSVNSCC.
I don't want to develop the visual interface so I used TortoiseSVN to
perform checkout, update and commit actions.
I wiil give back my work on TortoiseSVN and TortoiseSVNSCC to those projects
as soon as possible.

The source code :

svn_wc_status_t *getSVNStatus(CString fileName)
{
        AFX_MANAGE_STATE(AfxGetStaticModuleState()); //LC
        CsccsvnApp *theApp = (CsccsvnApp *) AfxGetApp( );
        CSCCEditor *editor = theApp->getEditor(); // get editor

        apr_hash_t * statushash;
        apr_array_header_t * statusarray;
        const sort_item * item;
        svn_error_t * m_err;
        svn_wc_status_t * status;
        apr_pool_t * m_pool = svn_pool_create (NULL);
        CString internalpath;
        CString resToken;
        int curPos= 0;
        svn_client_ctx_t ctx;

        bool update = false; // do not change => will create connection to server,
failed because no authentification defined
        bool noignore = false;

        if (fileName.GetLength() <= 0) return NULL;

        memset (&ctx, 0, sizeof (ctx));
        m_err = svn_config_get_config (&(ctx.config), NULL, m_pool);
        if (m_err)
        {
                svn_pool_destroy (m_pool); // free the allocated memory
                return NULL;
        } // if (m_err)

        //we need to convert the path to subversion internal format
        //the internal format uses '/' instead of the windows '\'
        internalpath = fileName.GetString();
        internalpath.Replace("\\", "/");

        statushash = apr_hash_make(m_pool);
        svn_revnum_t youngest = SVN_INVALID_REVNUM;
        svn_opt_revision_t rev;
        rev.kind = svn_opt_revision_unspecified;
        struct hashbaton_t hashbaton;
        hashbaton.hash = statushash;
        hashbaton.pool = m_pool;
        m_err = svn_client_status (&youngest, internalpath, &rev, getstatushash,
                              &hashbaton, FALSE, TRUE, update, noignore, &ctx, m_pool);

        // Error present if function is not under version control
        if ((m_err != NULL) || (apr_hash_count(statushash) == 0))
        {
                return NULL;
                // delete => bug in pb7
        }

        // Convert the unordered hash to an ordered, sorted array
        statusarray = sort_hash (statushash, sort_compare_items_as_paths, m_pool);

        //only the first entry is needed (no recurse)
        item = &APR_ARRAY_IDX (statusarray, 0, const sort_item);

        status = (svn_wc_status_t *) item->value;
        svn_pool_destroy (m_pool);

        return status;
}

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Dec 15 16:12:34 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.