Skip to content

Commit

Permalink
[raz] Remove max limit for bulk key deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
Harshg999 committed Nov 7, 2023
1 parent 2e025ae commit 1669004
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 19 deletions.
2 changes: 0 additions & 2 deletions desktop/conf.dist/hue.ini
Original file line number Diff line number Diff line change
Expand Up @@ -935,8 +935,6 @@ tls=no

# Settings for the Google Cloud lib
# ------------------------------------------------------------------------
# Maximum number of keys with specific directory prefix that can be deleted in a single bulk operation in GS.
## gs_bulk_delete_dir_keys_max_limit=100

[[gc_accounts]]
[[[default]]]
Expand Down
2 changes: 0 additions & 2 deletions desktop/conf/pseudo-distributed.ini.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -918,8 +918,6 @@

# Settings for the Google Cloud lib
# ------------------------------------------------------------------------
# Maximum number of keys with specific directory prefix that can be deleted in a single bulk operation in GS.
## gs_bulk_delete_dir_keys_max_limit=100

[[gc_accounts]]
[[[default]]]
Expand Down
7 changes: 0 additions & 7 deletions desktop/core/src/desktop/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2591,13 +2591,6 @@ def get_ldap_bind_password(ldap_config):

PERMISSION_ACTION_GS = "gs_access"

GS_BULK_DELETE_DIR_KEYS_MAX_LIMIT = Config(
help=_('Maximum number of keys with specific directory prefix that can be deleted in a single bulk operation in GS.'),
key='gs_bulk_delete_dir_keys_max_limit',
default=1000,
type=coerce_zero_or_positive_integer
)

GC_ACCOUNTS = UnspecifiedConfigSection(
'gc_accounts',
help=_('One entry for each GC account'),
Expand Down
9 changes: 1 addition & 8 deletions desktop/core/src/desktop/lib/fs/gc/gs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from boto.s3.prefix import Prefix
from django.utils.translation import gettext as _

from desktop.conf import PERMISSION_ACTION_GS, GS_BULK_DELETE_DIR_KEYS_MAX_LIMIT, is_raz_gs
from desktop.conf import PERMISSION_ACTION_GS, is_raz_gs
from desktop.lib.fs.gc import GS_ROOT, abspath, parse_uri, translate_gs_error, normpath, join as gs_join
from desktop.lib.fs.gc.gsstat import GSStat
from desktop.lib.fs.gc.gsfile import open as gsfile_open
Expand Down Expand Up @@ -310,15 +310,8 @@ def rmtree(self, path, skipTrash=True):
else:
# key.bucket.delete_keys() call is not supported from GS side
# So, try deleting the all keys with directory prefix one by one

# TODO: Check on the UI side if key count is greater than max limit and show nice notification.
deleted_dir_key_count = 0
for key in list(dir_keys):
if deleted_dir_key_count > GS_BULK_DELETE_DIR_KEYS_MAX_LIMIT.get():
break

deleted_key = key.delete()
deleted_dir_key_count += 1

@translate_gs_error
@auth_error_handler
Expand Down

0 comments on commit 1669004

Please sign in to comment.