@ -3430,14 +3430,14 @@ Status DBImpl::DeleteFile(std::string name) {
FileType type ;
FileType type ;
WalFileType log_type ;
WalFileType log_type ;
if ( ! ParseFileName ( name , & number , & type , & log_type ) | |
if ( ! ParseFileName ( name , & number , & type , & log_type ) | |
( type ! = kTableFile & & type ! = kLog File ) ) {
( type ! = kTableFile & & type ! = kWal File ) ) {
ROCKS_LOG_ERROR ( immutable_db_options_ . info_log , " DeleteFile %s failed. \n " ,
ROCKS_LOG_ERROR ( immutable_db_options_ . info_log , " DeleteFile %s failed. \n " ,
name . c_str ( ) ) ;
name . c_str ( ) ) ;
return Status : : InvalidArgument ( " Invalid file name " ) ;
return Status : : InvalidArgument ( " Invalid file name " ) ;
}
}
Status status ;
Status status ;
if ( type = = kLog File ) {
if ( type = = kWal File ) {
// Only allow deleting archived log files
// Only allow deleting archived log files
if ( log_type ! = kArchivedLogFile ) {
if ( log_type ! = kArchivedLogFile ) {
ROCKS_LOG_ERROR ( immutable_db_options_ . info_log ,
ROCKS_LOG_ERROR ( immutable_db_options_ . info_log ,
@ -3862,7 +3862,7 @@ Status DestroyDB(const std::string& dbname, const Options& options,
std : : string path_to_delete = dbname + " / " + fname ;
std : : string path_to_delete = dbname + " / " + fname ;
if ( type = = kMetaDatabase ) {
if ( type = = kMetaDatabase ) {
del = DestroyDB ( path_to_delete , options ) ;
del = DestroyDB ( path_to_delete , options ) ;
} else if ( type = = kTableFile | | type = = kLog File ) {
} else if ( type = = kTableFile | | type = = kWal File ) {
del = DeleteDBFile ( & soptions , path_to_delete , dbname ,
del = DeleteDBFile ( & soptions , path_to_delete , dbname ,
/*force_bg=*/ false , /*force_fg=*/ ! wal_in_db_path ) ;
/*force_bg=*/ false , /*force_fg=*/ ! wal_in_db_path ) ;
} else {
} else {
@ -3916,7 +3916,7 @@ Status DestroyDB(const std::string& dbname, const Options& options,
if ( env - > GetChildren ( archivedir , & archiveFiles ) . ok ( ) ) {
if ( env - > GetChildren ( archivedir , & archiveFiles ) . ok ( ) ) {
// Delete archival files.
// Delete archival files.
for ( const auto & file : archiveFiles ) {
for ( const auto & file : archiveFiles ) {
if ( ParseFileName ( file , & number , & type ) & & type = = kLog File ) {
if ( ParseFileName ( file , & number , & type ) & & type = = kWal File ) {
Status del =
Status del =
DeleteDBFile ( & soptions , archivedir + " / " + file , archivedir ,
DeleteDBFile ( & soptions , archivedir + " / " + file , archivedir ,
/*force_bg=*/ false , /*force_fg=*/ ! wal_in_db_path ) ;
/*force_bg=*/ false , /*force_fg=*/ ! wal_in_db_path ) ;
@ -3932,7 +3932,7 @@ Status DestroyDB(const std::string& dbname, const Options& options,
// Delete log files in the WAL dir
// Delete log files in the WAL dir
if ( wal_dir_exists ) {
if ( wal_dir_exists ) {
for ( const auto & file : walDirFiles ) {
for ( const auto & file : walDirFiles ) {
if ( ParseFileName ( file , & number , & type ) & & type = = kLog File ) {
if ( ParseFileName ( file , & number , & type ) & & type = = kWal File ) {
Status del =
Status del =
DeleteDBFile ( & soptions , LogFileName ( soptions . wal_dir , number ) ,
DeleteDBFile ( & soptions , LogFileName ( soptions . wal_dir , number ) ,
soptions . wal_dir , /*force_bg=*/ false ,
soptions . wal_dir , /*force_bg=*/ false ,