Commit c995200a authored by Julien Muchembled's avatar Julien Muchembled

storage: new --disable-drop-partitions option

parent 6ee35041
...@@ -97,6 +97,9 @@ class ConfigurationManager(object): ...@@ -97,6 +97,9 @@ class ConfigurationManager(object):
bind = self.__get('bind') bind = self.__get('bind')
return parseNodeAddress(bind, 0) return parseNodeAddress(bind, 0)
def getDisableDropPartitions(self):
return self.__get('disable_drop_partitions', True)
def getDatabase(self): def getDatabase(self):
return self.__get('database') return self.__get('database')
......
...@@ -30,6 +30,11 @@ parser.add_option('-d', '--database', help = 'database connections string') ...@@ -30,6 +30,11 @@ parser.add_option('-d', '--database', help = 'database connections string')
parser.add_option('-e', '--engine', help = 'database engine') parser.add_option('-e', '--engine', help = 'database engine')
parser.add_option('-w', '--wait', help='seconds to wait for backend to be ' parser.add_option('-w', '--wait', help='seconds to wait for backend to be '
'available, before erroring-out (-1 = infinite)', type='float', default=0) 'available, before erroring-out (-1 = infinite)', type='float', default=0)
parser.add_option('--disable-drop-partitions', action='store_true',
help = 'do not delete data of discarded cells, which is'
' useful for big databases because the current'
' implementation is inefficient (this option should'
' disappear in the future)')
parser.add_option('--reset', action='store_true', parser.add_option('--reset', action='store_true',
help='remove an existing database if any, and exit') help='remove an existing database if any, and exit')
......
...@@ -48,6 +48,7 @@ class Application(BaseApplication): ...@@ -48,6 +48,7 @@ class Application(BaseApplication):
self.dm = buildDatabaseManager(config.getAdapter(), self.dm = buildDatabaseManager(config.getAdapter(),
(config.getDatabase(), config.getEngine(), config.getWait()), (config.getDatabase(), config.getEngine(), config.getWait()),
) )
self.disable_drop_partitions = config.getDisableDropPartitions()
# load master nodes # load master nodes
for master_address in config.getMasters(): for master_address in config.getMasters():
......
...@@ -38,6 +38,9 @@ class InitializationHandler(BaseMasterHandler): ...@@ -38,6 +38,9 @@ class InitializationHandler(BaseMasterHandler):
# delete objects database # delete objects database
dm = app.dm dm = app.dm
if unassigned_set: if unassigned_set:
if app.disable_drop_partitions:
logging.info("don't drop data for partitions %r", unassigned_set)
else:
logging.debug('drop data for partitions %r', unassigned_set) logging.debug('drop data for partitions %r', unassigned_set)
dm.dropPartitions(unassigned_set) dm.dropPartitions(unassigned_set)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment