Entropy/Server:
- use indexes on the server database too but drop them before uploading git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@1637 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
+10
-10
@@ -3256,29 +3256,29 @@ class etpDatabase:
|
||||
self.createConfigProtectReferenceIndex()
|
||||
|
||||
def createNeededIndex(self):
|
||||
if (self.dbname != etpConst['serverdbid']) and self.indexing:
|
||||
if self.indexing:
|
||||
self.cursor.execute('CREATE INDEX IF NOT EXISTS neededindex ON neededreference ( library )')
|
||||
self.cursor.execute('CREATE INDEX IF NOT EXISTS neededindex_idneeded ON needed ( idneeded )')
|
||||
self.commitChanges()
|
||||
|
||||
def createUseflagsIndex(self):
|
||||
if (self.dbname != etpConst['serverdbid']) and self.indexing:
|
||||
if self.indexing:
|
||||
self.cursor.execute('CREATE INDEX IF NOT EXISTS useflagsindex ON useflagsreference ( flagname )')
|
||||
self.commitChanges()
|
||||
|
||||
def createContentIndex(self):
|
||||
if (self.dbname != etpConst['serverdbid']) and self.indexing:
|
||||
if self.indexing:
|
||||
self.cursor.execute('CREATE INDEX IF NOT EXISTS contentindex_couple ON content ( idpackage )')
|
||||
self.cursor.execute('CREATE INDEX IF NOT EXISTS contentindex_file ON content ( file )')
|
||||
self.commitChanges()
|
||||
|
||||
def createConfigProtectReferenceIndex(self):
|
||||
if (self.dbname != etpConst['serverdbid']) and self.indexing:
|
||||
if self.indexing:
|
||||
self.cursor.execute('CREATE INDEX IF NOT EXISTS configprotectreferenceindex ON configprotectreference ( protect )')
|
||||
self.commitChanges()
|
||||
|
||||
def createBaseinfoIndex(self):
|
||||
if (self.dbname != etpConst['serverdbid']) and self.indexing:
|
||||
if self.indexing:
|
||||
self.cursor.execute('CREATE INDEX IF NOT EXISTS baseindex_atom ON baseinfo ( atom )')
|
||||
self.cursor.execute('CREATE INDEX IF NOT EXISTS baseindex_branch_name ON baseinfo ( name,branch )')
|
||||
self.cursor.execute('CREATE INDEX IF NOT EXISTS baseindex_branch_name_idcategory ON baseinfo ( name,idcategory,branch )')
|
||||
@@ -3286,30 +3286,30 @@ class etpDatabase:
|
||||
self.commitChanges()
|
||||
|
||||
def createLicensedataIndex(self):
|
||||
if (self.dbname != etpConst['serverdbid']) and self.indexing:
|
||||
if self.indexing:
|
||||
if not self.doesTableExist("licensedata"):
|
||||
return
|
||||
self.cursor.execute('CREATE INDEX IF NOT EXISTS licensedataindex ON licensedata ( licensename )')
|
||||
self.commitChanges()
|
||||
|
||||
def createLicensesIndex(self):
|
||||
if (self.dbname != etpConst['serverdbid']) and self.indexing:
|
||||
if self.indexing:
|
||||
self.cursor.execute('CREATE INDEX IF NOT EXISTS licensesindex ON licenses ( license )')
|
||||
self.commitChanges()
|
||||
|
||||
def createKeywordsIndex(self):
|
||||
if (self.dbname != etpConst['serverdbid']) and self.indexing:
|
||||
if self.indexing:
|
||||
self.cursor.execute('CREATE INDEX IF NOT EXISTS keywordsreferenceindex ON keywordsreference ( keywordname )')
|
||||
self.commitChanges()
|
||||
|
||||
def createDependenciesIndex(self):
|
||||
if (self.dbname != etpConst['serverdbid']) and self.indexing:
|
||||
if self.indexing:
|
||||
self.cursor.execute('CREATE INDEX IF NOT EXISTS dependenciesindex_idpackage_iddependency ON dependencies ( idpackage, iddependency )')
|
||||
self.cursor.execute('CREATE INDEX IF NOT EXISTS dependenciesreferenceindex_dependency ON dependenciesreference ( dependency )')
|
||||
self.commitChanges()
|
||||
|
||||
def createExtrainfoIndex(self):
|
||||
if (self.dbname != etpConst['serverdbid']) and self.indexing:
|
||||
if self.indexing:
|
||||
self.cursor.execute('CREATE INDEX IF NOT EXISTS extrainfoindex ON extrainfo ( description )')
|
||||
self.commitChanges()
|
||||
|
||||
|
||||
+11
-7
@@ -11091,11 +11091,14 @@ class ServerInterface(TextInterface):
|
||||
conn.serverUpdatePackagesData()
|
||||
else:
|
||||
self.updateProgress(
|
||||
red("Entropy database is probably empty. If you don't agree with what I'm saying, then it's probably corrupted! I won't stop you here btw..."),
|
||||
importance = 1,
|
||||
type = "info",
|
||||
header = red(" * ")
|
||||
)
|
||||
darkred("Entropy database is probably empty. If you don't agree with what I'm saying, " + \
|
||||
"then it's probably corrupted! I won't stop you here btw..."),
|
||||
importance = 1,
|
||||
type = "warning",
|
||||
header = bold(" !!! ")
|
||||
)
|
||||
if not read_only:
|
||||
conn.createAllIndexes()
|
||||
# do not cache ultra-readonly dbs
|
||||
if not just_reading:
|
||||
self.serverDbCache[(etpConst['systemroot'],read_only,no_upload,just_reading,)] = conn
|
||||
@@ -13277,8 +13280,9 @@ class ServerMirrorsInterface:
|
||||
ftp.closeConnection()
|
||||
return gave_up
|
||||
|
||||
def vacuum_database_and_close(self):
|
||||
def shrink_database_and_close(self):
|
||||
dbconn = self.Entropy.openServerDatabase(read_only = False, no_upload = True)
|
||||
dbconn.dropAllIndexes()
|
||||
dbconn.vacuum()
|
||||
dbconn.commitChanges()
|
||||
self.Entropy.close_server_database(dbconn)
|
||||
@@ -13324,7 +13328,7 @@ class ServerMirrorsInterface:
|
||||
header = darkgreen(" * ")
|
||||
)
|
||||
|
||||
self.vacuum_database_and_close()
|
||||
self.shrink_database_and_close()
|
||||
|
||||
# EAPI 2
|
||||
self._show_eapi2_upload_messages(crippled_uri, database_path, upload_data, cmethod)
|
||||
|
||||
Reference in New Issue
Block a user