in core/lib/payload/copy.py [0:0]
def check_disk_size(self):
"""
Check if we have enough disk space to execute the DDL
"""
if self.skip_disk_space_check:
return True
self.table_size = int(self.get_table_size(self.table_name))
disk_space = int(util.disk_partition_free(self.outfile_dir))
# With allow_new_pk, we will create one giant outfile, and so at
# some point will have the entire new table and the entire outfile
# both existing simultaneously.
if self.allow_new_pk and not self._old_table.primary_key.column_list:
required_size = self.table_size * 2
else:
required_size = self.table_size * 1.1
log.info(
"Disk space required: {}, available: {}".format(
util.readable_size(required_size), util.readable_size(disk_space)
)
)
if required_size > disk_space:
raise OSCError(
"NOT_ENOUGH_SPACE",
{
"need": util.readable_size(required_size),
"avail": util.readable_size(disk_space),
},
)