Hoo man has uploaded a new change for review.
https://gerrit.wikimedia.org/r/260793
Change subject: Delete at least one second worth of data in ChangePruner
......................................................................
Delete at least one second worth of data in ChangePruner
It's not to bad to go slightly over the batch size
here as its just one second worth of data which
is never going to be more than a thousand rows.
A deletion of ~1500 rows (as the default batch size
is 500) is not nice, but also not worrisome.
Bug: T122336
Change-Id: I37ced5f3fb3ed4a16632980b47f6f588c0839bef
---
M repo/includes/ChangePruner.php
M repo/tests/phpunit/includes/ChangePrunerTest.php
2 files changed, 9 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/93/260793/1
diff --git a/repo/includes/ChangePruner.php b/repo/includes/ChangePruner.php
index 95dd141..fc97946 100644
--- a/repo/includes/ChangePruner.php
+++ b/repo/includes/ChangePruner.php
@@ -120,7 +120,12 @@
}
}
- return $this->limitCutoffTimestamp( wfTimestamp( TS_MW, $until
) );
+ $limitedTimestamp = $this->limitCutoffTimestamp( wfTimestamp(
TS_MW, $until ) );
+
+ // Add one second just to make sure we delete at least one
second worth of data
+ // as sometimes there are more edits in a single second than
$this->batchSize
+ // (the peak on Wikidata is almost 550).
+ return wfTimestamp( TS_MW, wfTimestamp( TS_UNIX,
$limitedTimestamp ) + 1 );
}
/**
@@ -139,7 +144,7 @@
array( 'change_time < ' . $dbr->addQuotes( $until ) ),
__METHOD__,
array(
- 'OFFSET' => $this->batchSize,
+ 'OFFSET' => $this->batchSize - 1,
'ORDER BY' => 'change_time ASC',
)
);
diff --git a/repo/tests/phpunit/includes/ChangePrunerTest.php
b/repo/tests/phpunit/includes/ChangePrunerTest.php
index e30285d..7d6d3f9 100644
--- a/repo/tests/phpunit/includes/ChangePrunerTest.php
+++ b/repo/tests/phpunit/includes/ChangePrunerTest.php
@@ -42,8 +42,9 @@
$this->assertEquals( 6, count( $this->messages ), 'pruner has
reported 6 messages' );
- $this->assertContains( 'pruning entries older than
2015-01-01T00:03:00Z', $this->messages[0] );
+ $this->assertContains( 'pruning entries older than
2015-01-01T00:00:06Z', $this->messages[0] );
$this->assertContains( '1 rows pruned', $this->messages[1] );
+ $this->assertContains( 'pruning entries older than
2015-01-01T00:03:01Z', $this->messages[2] );
$this->assertContains( '1 rows pruned', $this->messages[3] );
$this->assertContains( '0 rows pruned', $this->messages[5] );
--
To view, visit https://gerrit.wikimedia.org/r/260793
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I37ced5f3fb3ed4a16632980b47f6f588c0839bef
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Hoo man <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits