[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Dump entities: Add --no-cache to avoid reading from entity c...

2017-11-13 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/391050 )

Change subject: Dump entities: Add --no-cache to avoid reading from entity 
caches
..


Dump entities: Add --no-cache to avoid reading from entity caches

In production we know that the hit rate for on the cache will be
0 if on Zend… thus it's way way faster to not bother looking.

Bug: T180048
Change-Id: I7c8515ad83eee3c66c69a2282cdee974ed149900
---
M repo/maintenance/dumpEntities.php
M repo/maintenance/dumpJson.php
M repo/maintenance/dumpRdf.php
3 files changed, 18 insertions(+), 2 deletions(-)

Approvals:
  jenkins-bot: Verified
  Thiemo Mättig (WMDE): Looks good to me, approved



diff --git a/repo/maintenance/dumpEntities.php 
b/repo/maintenance/dumpEntities.php
index defdfa8..5f887f6 100644
--- a/repo/maintenance/dumpEntities.php
+++ b/repo/maintenance/dumpEntities.php
@@ -51,6 +51,7 @@
$this->addOption( 'log', "Log file (default is stderr). Will be 
appended.", false, true );
$this->addOption( 'quiet', "Disable progress reporting", false, 
false );
$this->addOption( 'limit', "Limit how many entities are 
dumped.", false, true );
+   $this->addOption( 'no-cache', "If this is set, don't try to 
read from an EntityRevisionCache.", false, false );
}
 
public function setDumpEntitiesServices( SqlEntityIdPagerFactory 
$sqlEntityIdPagerFactory ) {
@@ -211,6 +212,19 @@
}
 
/**
+* Cache flag for use in Store::getEntityRevisionLookup.
+*
+* @return string One of "retrieve-only" and "uncached"
+*/
+   protected function getEntityRevisionLookupCacheMode() {
+   if ( $this->getOption( 'no-cache', false ) ) {
+   return 'uncached';
+   } else {
+   return 'retrieve-only';
+   }
+   }
+
+   /**
 * @param string|null $entityType
 *
 * @return SqlEntityIdPager
diff --git a/repo/maintenance/dumpJson.php b/repo/maintenance/dumpJson.php
index ef93de1..05d19f0 100644
--- a/repo/maintenance/dumpJson.php
+++ b/repo/maintenance/dumpJson.php
@@ -80,7 +80,9 @@
$wikibaseRepo->getEntityNamespaceLookup(),
$wikibaseRepo->getEntityIdParser()
);
-   $revisionLookup = 
$wikibaseRepo->getEntityRevisionLookup( 'retrieve-only' );
+   $revisionLookup = 
$wikibaseRepo->getEntityRevisionLookup(
+   $this->getEntityRevisionLookupCacheMode()
+   );
 
$this->setServices(
$sqlEntityIdPagerFactory,
diff --git a/repo/maintenance/dumpRdf.php b/repo/maintenance/dumpRdf.php
index f1e6b1b..0ad22a5 100644
--- a/repo/maintenance/dumpRdf.php
+++ b/repo/maintenance/dumpRdf.php
@@ -120,7 +120,7 @@
$wikibaseRepo->getPropertyDataTypeLookup(),
$wikibaseRepo->getValueSnakRdfBuilderFactory(),
$wikibaseRepo->getEntityRdfBuilderFactory(),
-   $wikibaseRepo->getEntityRevisionLookup( 
'retrieve-only' ),
+   $wikibaseRepo->getEntityRevisionLookup( 
$this->getEntityRevisionLookupCacheMode() ),
$wikibaseRepo->getRdfVocabulary(),
$wikibaseRepo->getEntityContentFactory()
);

-- 
To view, visit https://gerrit.wikimedia.org/r/391050
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7c8515ad83eee3c66c69a2282cdee974ed149900
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Hoo man 
Gerrit-Reviewer: ArielGlenn 
Gerrit-Reviewer: Aude 
Gerrit-Reviewer: Daniel Kinzler 
Gerrit-Reviewer: Hoo man 
Gerrit-Reviewer: Ladsgroup 
Gerrit-Reviewer: Smalyshev 
Gerrit-Reviewer: Thiemo Mättig (WMDE) 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Dump entities: Add --no-cache to avoid reading from entity c...

2017-11-13 Thread Hoo man (Code Review)
Hoo man has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/391050 )

Change subject: Dump entities: Add --no-cache to avoid reading from entity 
caches
..

Dump entities: Add --no-cache to avoid reading from entity caches

In production we know that the hit rate for on the cache will be
0 if on Zend… thus it's way way faster to not bother looking.

Bug: T180048
Change-Id: I7c8515ad83eee3c66c69a2282cdee974ed149900
---
M repo/maintenance/dumpEntities.php
M repo/maintenance/dumpJson.php
M repo/maintenance/dumpRdf.php
3 files changed, 18 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/50/391050/1

diff --git a/repo/maintenance/dumpEntities.php 
b/repo/maintenance/dumpEntities.php
index defdfa8..5f887f6 100644
--- a/repo/maintenance/dumpEntities.php
+++ b/repo/maintenance/dumpEntities.php
@@ -51,6 +51,7 @@
$this->addOption( 'log', "Log file (default is stderr). Will be 
appended.", false, true );
$this->addOption( 'quiet', "Disable progress reporting", false, 
false );
$this->addOption( 'limit', "Limit how many entities are 
dumped.", false, true );
+   $this->addOption( 'no-cache', "If this is set, don't try to 
read from an EntityRevisionCache.", false, false );
}
 
public function setDumpEntitiesServices( SqlEntityIdPagerFactory 
$sqlEntityIdPagerFactory ) {
@@ -211,6 +212,19 @@
}
 
/**
+* Cache flag for use in Store::getEntityRevisionLookup.
+*
+* @return string One of "retrieve-only" and "uncached"
+*/
+   protected function getEntityRevisionLookupCacheMode() {
+   if ( $this->getOption( 'no-cache', false ) ) {
+   return 'uncached';
+   } else {
+   return 'retrieve-only';
+   }
+   }
+
+   /**
 * @param string|null $entityType
 *
 * @return SqlEntityIdPager
diff --git a/repo/maintenance/dumpJson.php b/repo/maintenance/dumpJson.php
index ef93de1..05d19f0 100644
--- a/repo/maintenance/dumpJson.php
+++ b/repo/maintenance/dumpJson.php
@@ -80,7 +80,9 @@
$wikibaseRepo->getEntityNamespaceLookup(),
$wikibaseRepo->getEntityIdParser()
);
-   $revisionLookup = 
$wikibaseRepo->getEntityRevisionLookup( 'retrieve-only' );
+   $revisionLookup = 
$wikibaseRepo->getEntityRevisionLookup(
+   $this->getEntityRevisionLookupCacheMode()
+   );
 
$this->setServices(
$sqlEntityIdPagerFactory,
diff --git a/repo/maintenance/dumpRdf.php b/repo/maintenance/dumpRdf.php
index f1e6b1b..0ad22a5 100644
--- a/repo/maintenance/dumpRdf.php
+++ b/repo/maintenance/dumpRdf.php
@@ -120,7 +120,7 @@
$wikibaseRepo->getPropertyDataTypeLookup(),
$wikibaseRepo->getValueSnakRdfBuilderFactory(),
$wikibaseRepo->getEntityRdfBuilderFactory(),
-   $wikibaseRepo->getEntityRevisionLookup( 
'retrieve-only' ),
+   $wikibaseRepo->getEntityRevisionLookup( 
$this->getEntityRevisionLookupCacheMode() ),
$wikibaseRepo->getRdfVocabulary(),
$wikibaseRepo->getEntityContentFactory()
);

-- 
To view, visit https://gerrit.wikimedia.org/r/391050
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7c8515ad83eee3c66c69a2282cdee974ed149900
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Hoo man 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits