Page MenuHomePhabricator

Remove unused or barely used functions of IDatabase
Closed, ResolvedPublic

Description

IDatabase is a massive interface and has more than 140 functions. This goes against software design principles (such as encapsulation or "deep interfaces" concept). As start, we should at least remove barely used functions. A search of function names showed these functions have less than ten search results (there is at least one for the interface, some for the implementations):

    1. Methods
  • buildSubString 2
  • preCommitCallbacksPending 3
    • Removed
  • pendingWriteRowsAffected 3
    • Removed
  • wasConnectionLoss 3
  • wasErrorReissuable 3
  • getTopologyRootMaster 4
    • Removed
  • trxTimestamp 4
  • assertNoOpenTransactions 4
    • Removed
  • pendingWriteCallers 4
  • aggregateValue 4
    • Removed
  • bitNot 4
  • bitOr 4
  • getServerUptime 4
    • Removed
  • masterPosWait 4
    • Removed
  • onTransactionIdle 4
    • Removed
  • lockIsFree 4
  • implicitOrderby 5
  • writesPending 5
  • unionConditionPermutations 5
  • wasLockTimeout 5
  • setBigSelects 5
  • getTopologyBasedServerId 6
  • getTopologyRole 6
  • getTopologyRootPrimary 6
  • lastDoneWrites 6
  • writesOrCallbacksPending 6
  • pendingWriteQueryDuration 6
  • buildLeast 6
  • selectDomain 6
  • wasDeadlock 6
  • wasReadOnlyError 6
  • getReplicaPos 6
  • onAtomicSectionCancel 6
  • setSchemaVars 6
  • namedLocksEnqueue 6
  • explicitTrxActive 7
  • dbSchema 7
  • setLBInfo 7
  • restoreFlags 7
  • dataSeek 7
    • Removed
  • buildGreatest 7
  • databasesAreIndependent 7
  • anyChar 7
  • strreplace 7
  • getMasterPos 7
  • serverIsReadOnly 7
  • lastQuery 8
  • numFields 8
    • Removed
  • getSoftwareLink 8
  • primaryPosWait 8
  • flushSnapshot 8
  • getSessionLagStatus 8
  • maxListLen 8
    • Removed
  • setSessionOptions 8
  • decodeExpiry 8
  • setIndexAliases 8
  • getLBInfo 9
  • makeWhereFrom2d 9
  • buildIntegerCast 9
  • selectDB 9
  • deleteJoin 9
  • unionSupportsOrderAndLimit 9
  • setTransactionListener 9
  • encodeExpiry 9

Some might be important and used in critical paths, we can simply mark them as needed. We should generally take a look at how Rdbms is architected and rework that.

Event Timeline

Change 743243 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@master] Remove IDatabase::preCommitCallbacksPending()

https://gerrit.wikimedia.org/r/743243

Change 743244 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@master] rdbms: Remove IDatabase::pendingWriteRowsAffected()

https://gerrit.wikimedia.org/r/743244

Change 743250 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@master] Remove four unused IDatabase::was* methods

https://gerrit.wikimedia.org/r/743250

Change 743251 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@master] rdbms: Remove IDatabase::getServerUptime()

https://gerrit.wikimedia.org/r/743251

Marostegui moved this task from Triage to In progress on the DBA board.

Change 743243 merged by jenkins-bot:

[mediawiki/core@master] Remove IDatabase::preCommitCallbacksPending()

https://gerrit.wikimedia.org/r/743243

Change 743244 merged by jenkins-bot:

[mediawiki/core@master] rdbms: Remove IDatabase::pendingWriteRowsAffected()

https://gerrit.wikimedia.org/r/743244

Change 745211 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@master] rdbms: Drop IDatabase::aggregateValue()

https://gerrit.wikimedia.org/r/745211

Change 743251 merged by jenkins-bot:

[mediawiki/core@master] rdbms: Remove IDatabase::getServerUptime()

https://gerrit.wikimedia.org/r/743251

Change 745216 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@master] rdbms: Remove five deprecated methods from IDatabase

https://gerrit.wikimedia.org/r/745216

Change 745211 merged by jenkins-bot:

[mediawiki/core@master] rdbms: Drop IDatabase::aggregateValue()

https://gerrit.wikimedia.org/r/745211

Change 745216 merged by jenkins-bot:

[mediawiki/core@master] rdbms: Remove five deprecated methods from IDatabase

https://gerrit.wikimedia.org/r/745216

Change 745644 had a related patch set uploaded (by Krinkle; author: Aaron Schulz):

[mediawiki/core@master] rdbms: remove internal assertNoOpenTransactions() method from IDatabase

https://gerrit.wikimedia.org/r/745644

Change 745644 merged by jenkins-bot:

[mediawiki/core@master] rdbms: remove internal assertNoOpenTransactions() method from IDatabase

https://gerrit.wikimedia.org/r/745644

Change 748750 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@master] Drop unused IDatabase::numFields()

https://gerrit.wikimedia.org/r/748750

Change 748754 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@master] rdbms: Drop unused and deprecated IDatabase::fieldName()

https://gerrit.wikimedia.org/r/748754

Change 748763 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@master] rdbms: Drop unused IDatabase::lastQuery()

https://gerrit.wikimedia.org/r/748763

Change 748764 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@master] rdbms: Drop unused IDatabase::maxListLen()

https://gerrit.wikimedia.org/r/748764

Change 748750 merged by jenkins-bot:

[mediawiki/core@master] rdbms: Remove IDatabase::numFields() method

https://gerrit.wikimedia.org/r/748750

Change 748754 merged by jenkins-bot:

[mediawiki/core@master] rdbms: Remove IDatabase::fieldName() method

https://gerrit.wikimedia.org/r/748754

Change 748764 merged by jenkins-bot:

[mediawiki/core@master] rdbms: Drop unused IDatabase::maxListLen()

https://gerrit.wikimedia.org/r/748764

Change 752214 had a related patch set uploaded (by Krinkle; author: Aaron Schulz):

[mediawiki/core@master] rdbms: remove \"groupLoadsByDB\" from LBFactoryMulti

https://gerrit.wikimedia.org/r/752214

Change 752214 merged by jenkins-bot:

[mediawiki/core@master] rdbms: remove \"groupLoadsByDB\" from LBFactoryMulti

https://gerrit.wikimedia.org/r/752214

Ladsgroup moved this task from In progress to Done on the DBA board.

While there are many more to clean up, but this is good as the first stab at the class (not the library). I'm sure I will be creating more tickets for this once we clean up other classes in rdbms library. (I'm planning to tackle LB and LBFactory next). And I want to avoid keeping this ticket open forever.