Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
8e2acb14
Commit
8e2acb14
authored
10 years ago
by
Jörn Friedrich Dreyer
Browse files
Options
Downloads
Patches
Plain Diff
repair search lucene before installing
parent
dc99fd76
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/private/repair.php
+2
-1
2 additions, 1 deletion
lib/private/repair.php
lib/repair/innodb.php
+1
-1
1 addition, 1 deletion
lib/repair/innodb.php
lib/repair/searchlucenetables.php
+63
-0
63 additions, 0 deletions
lib/repair/searchlucenetables.php
with
66 additions
and
2 deletions
lib/private/repair.php
+
2
−
1
View file @
8e2acb14
...
...
@@ -84,7 +84,8 @@ class Repair extends BasicEmitter {
public
static
function
getBeforeUpgradeRepairSteps
()
{
return
array
(
new
\OC\Repair\InnoDB
(),
new
\OC\Repair\Collation
(
\OC
::
$server
->
getConfig
(),
\OC_DB
::
getConnection
())
new
\OC\Repair\Collation
(
\OC
::
$server
->
getConfig
(),
\OC_DB
::
getConnection
()),
new
\OC\Repair\SearchLuceneTables
()
);
}
...
...
This diff is collapsed.
Click to expand it.
lib/repair/innodb.php
+
1
−
1
View file @
8e2acb14
...
...
@@ -23,7 +23,7 @@ class InnoDB extends BasicEmitter implements \OC\RepairStep {
public
function
run
()
{
$connection
=
\OC_DB
::
getConnection
();
if
(
!
$connection
->
getDatabasePlatform
()
instanceof
MySqlPlatform
)
{
$this
->
emit
(
'\OC\Repair'
,
'info'
,
array
(
'Not a mysql database -> nothing to
n
o'
));
$this
->
emit
(
'\OC\Repair'
,
'info'
,
array
(
'Not a mysql database -> nothing to
d
o'
));
return
;
}
...
...
This diff is collapsed.
Click to expand it.
lib/repair/searchlucenetables.php
0 → 100644
+
63
−
0
View file @
8e2acb14
<?php
/**
* Copyright (c) 2014 Jörn Friedrich Dreyer <jfd@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace
OC\Repair
;
use
OC\Hooks\BasicEmitter
;
class
SearchLuceneTables
extends
BasicEmitter
implements
\OC\RepairStep
{
public
function
getName
()
{
return
'Repair duplicate entries in oc_lucene_status'
;
}
/**
* Fix duplicate entries in oc_lucene_status
*
* search_lucene prior to v0.5.0 did not have a primary key on the lucene_status table. Newer versions do, which
* causes the migration check to fail because it tries to insert duplicate rows into the new schema.
*
* FIXME Currently, apps don't have a way of repairing anything before the migration check:
* @link https://github.com/owncloud/core/issues/10980
*
* As a result this repair step needs to live in the core repo, although it belongs into search_lucene:
* @link https://github.com/owncloud/core/issues/10205#issuecomment-54957557
*
* It will completely remove any rows that make a file id have more than one status:
* fileid | status fileid | status
* --------+-------- will become --------+--------
* 2 | E 3 | E
* 2 | I
* 3 | E
*
* search_lucene will then reindex the fileids without a status when the next indexing job is executed
*/
public
function
run
()
{
if
(
\OC_DB
::
tableExists
(
'lucene_status'
))
{
$this
->
emit
(
'\OC\Repair'
,
'info'
,
array
(
'removing duplicate entries from lucene_status'
));
$connection
=
\OC_DB
::
getConnection
();
$query
=
$connection
->
prepare
(
'
DELETE FROM `*PREFIX*lucene_status`
WHERE `fileid` IN (
SELECT `fileid`
FROM (
SELECT `fileid`
FROM `*PREFIX*lucene_status`
GROUP BY `fileid`
HAVING count(`fileid`) > 1
) AS `mysqlerr1093hack`
)'
);
$query
->
execute
();
}
else
{
$this
->
emit
(
'\OC\Repair'
,
'info'
,
array
(
'lucene_status table does not exist -> nothing to do'
));
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment