sagemathinc / cocalc

CoCalc: Collaborative Calculation in the Cloud
https://CoCalc.com
Other
1.17k stars 216 forks source link

duplicate key when copying files? #3163

Closed haraldschilly closed 1 week ago

haraldschilly commented 6 years ago

I tried to copy a file (ipynb notebook) from one project (root dir) into a subdirectory of another project. I saw the error below (in a floating alert box). Then I tried again, and that error was still there.

What does it actually mean? That there is already a pending copy operation? ... or is this actually some sort of bug? In any case, it's weird and confusing.

screenshot from 2018-09-10 14-25-18

williamstein commented 6 years ago

I have never seen this, even once, in over a year.

This doesn't have anything to do with the open source part of cocalc, so I'm closing this ticket; it should be in kucalc.

williamstein commented 6 years ago

This doesn't have anything to do with the open source part of cocalc,

OK, I'm wrong about that, the code that makes this:

        copy_id = misc.uuid()
        dbg = @dbg("copy_path('#{opts.path}', id='#{copy_id}')")
        dbg("copy a path using rsync from one project to another")
        @active()
        async.series([
            (cb) =>
                dbg("get synctable")
                @client.copy_paths_synctable (err, s) =>
                    synctable = s; cb(err)
            (cb) =>
                @active()
                dbg('write query requesting the copy to the database')
                @database._query
                    query  : "INSERT INTO copy_paths"
                    values :
                        "id                ::UUID"      : copy_id

in cocalc/src/smc-hub/kucalc/compute-client.coffee

It's a random uuid, so if you get it twice, somehow it must be trying to rerun the same query. But fails due to that being the primary key. There should be no possible way that it would try to rerun the same query.

williamstein commented 6 years ago

Either that or misc.uuid() isn't so random after all.

williamstein commented 1 week ago

too unclear