Server error when trying to edit content block
After upgrading to 4.2 I get a server error when I try to edit any content block on a page. The error appears in the pop up window where the WYSIWYG appears.
Here is the error:
The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name 'dbo.sf_chunks' and the index name 'pk_sf_chunks'. The duplicate key value is (1, e3556e28-73db-4cce-b3d2-947a532dc47e).
Could not create constraint. See previous errors.
The statement has been terminated.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Telerik.OpenAccess.RT.sql.SQLException: The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name 'dbo.sf_chunks' and the index name 'pk_sf_chunks'. The duplicate key value is (1, e3556e28-73db-4cce-b3d2-947a532dc47e).
Could not create constraint. See previous errors.
The statement has been terminated
Hi Jeremy,
Which version of Sitefinity are you upgrading from?
Seems some of the upgrade procedures are not executed correctly. To fix this particular problem you should run the following SQL scripts:
delete
sf_chunks
from
sf_chunks
inner
join
(
select
file_id, ordinal,
count
(*)
as
cnt,
min
(sf_chunks_id)
as
chunkid
from
sf_chunks
group
by
file_id, ordinal
having
count
(*) > 1
)
as
t1
on
sf_chunks.file_id = t1.file_id
and
sf_chunks.ordinal = t1.ordinal
where
sf_chunks.sf_chunks_id <> t1.chunkid
ALTER
TABLE
sf_chunks
DROP
CONSTRAINT
pk_sf_chunks
ALTER
TABLE
sf_chunks
DROP
COLUMN
sf_chunks_id
Then, restart application.
Thank You Vlad, this worked!
WOW, whilst updating one of our customers last night, this error came up. I was mortified thinking that I had to revert them back after all the build-up. Anyway I do appreciate this post, but I don't appreciate the loss of my hair last night.
It seems to be fine now. After executing the first snippet of SQL successfully, the second snippet which is the two ALTER statements did not work. It said it could not find what it was looking for. The system is stable though.
Many thanks,
Andrei
Hi Andrei,
If the ALTER statement fails to drop something, saying that the "something" does not exist, this is not a problem.
Actually, the upgrade logic should be handled by Sitefinity and we don't know why there are some cases, in which this doesn't happen. We suspect that the problem appears if, after upgrading, another site with an older version of Sitefinity, which still point to the same database performs a downgrade of the database. This cannot be happen with the versions after 4.2, because in 4.2 we added a logic to prevent downgrading.
Do let us know if you have issues after the upgrade.
Kind regards,
Vlad
the Telerik team
Vlad,
I know what you are saying. I had a version of 4.1.1579 I think which was a custom build just for us because of some urgent upgrade we had to do for the customer. It was not an official version. When I came to upgrading it to 4.3.1885 which is a hotfix version, maybe it didn't like it. Anyway, it is stable for now. I will get back in case of any issues.
Many thanks,
Andrei
Vlad, really urgent. The customer contacted me this morning about not being able to upload documents. which sounded like this problem: www.sitefinity.com/.../4-2-can-t-upload-documents.aspx
So i went and installed silverlight on the IIS server because apparently that was somethign to do to fix the issue. I then tried to upload a document after that, and i get the attached error. This is very urgent. please advice.
Thanks,
Andrei
Hi Andrei,
From the attached error seems, that this is exactly the problem reported in this thread.
Could you restart the application and try to upload again. Then, if you still get the error, please execute the SQL script from this thread. This should upgrade the database.
However, did you said that this was working at some moment? If this is the case, maybe the database has been downgraded by another site with older version of Sitefinity.
The above could hopefully fix the problem, but as I mentioned before, every access to the database from a site with Sitefinity version prior to 4.2 could downgrade the database and bring this error again. So, you have to make sure, that only this site is connected to this database. I am suggesting you to rename (or restore with different name) the database and modify the connection string to use the new name.
Please, do let us know how it goes.
Kind regards,
Vlad
the Telerik team
vlad this is the view of the table in design view (attached).
i have two IIS servers and both run the identical version of the webapp. which is 4.3.1885.
Before running the script i was not even abale to log into the backend at all. after runing the script i am able to login to the backend, but can't upload any documents now or images.
i checked it on both sides Telerick.Sitefinity.dll shows 4.3.1885.0 so both sides are teh same version. I have not replaced all teh dlls with ones from a brand new project. the system is live and i am afraid that it might completely mess it up.
Hello Andrei,
As I can see from the design view of the sf_chunks table, it still contains sf_chunk_id. What happens when you execute the following script separately?
ALTER
TABLE
sf_chunks
DROP
COLUMN
sf_chunks_id
ALTER
TABLE
sf_chunks
DROP
CONSTRAINT
pk_sf_chunks
Vlad that fixed it. It is as you say. Because the first one failed teh seond one did not get executed. deleted the column and it is fine now. That's another fire put out. Deep breath.
Thank you,
Andrei
Vlad / Andrei,
I am getting a very similar error when trying to add new items into the SF library,.. such as an image or a document. See the attached screenshot of the error.
Should I execute in this thread to fix this error as well?
Currently we are using SF version 4.3.1885.0 SE for this site and this seems to be about the only error we are having.
Thank you for your assistance with this issue.
Vlad / Andrei,
I am getting a very similar error when trying to add new items into the SF library,.. such as an image or a document. See the attached screenshot of the error.
Should I execute in this thread to fix this error as well?
Currently we are using SF version 4.3.1885.0 SE for this site and this seems to be about the only error we are having.
Thank you for your assistance with this issue.
Benjamin,
I got the error when I have upgraded to the same version that you are. The error look like the same thing. What I would do is, take a back-up copy of teh project (both database and the application) get it running on a virtual machine or separate PC somewhere. Apply the fix suggested in this thread and see. I think it will sort your issue out. But make sure you do it on a separate test system. After you have done it, make sure the table looks ok, the offending field should not be there.
Many thanks,
Andrei
Andrei,
The script appears to have worked great and the site is working as expected. Thanks for the help and quick reply!
Ben