greenplumn storage_tablespace 源码
greenplumn storage_tablespace 代码
文件路径:/src/backend/catalog/storage_tablespace.c
#include "postgres.h"
#include "catalog/storage_tablespace.h"
static Oid pending_tablespace_scheduled_for_deletion_on_abort;
static Oid pending_tablespace_scheduled_for_deletion_on_commit;
static void (*unlink_tablespace_dir)(Oid tablespace_for_unlink, bool is_redo);
static void
tablespace_storage_reset_on_abort(void)
{
pending_tablespace_scheduled_for_deletion_on_abort = InvalidOid;
}
static void
tablespace_storage_reset_on_commit(void)
{
pending_tablespace_scheduled_for_deletion_on_commit = InvalidOid;
}
static void
perform_pending_tablespace_deletion_internal(Oid tablespace_oid_to_delete,
bool isRedo)
{
if (!OidIsValid(tablespace_oid_to_delete))
return;
unlink_tablespace_dir(tablespace_oid_to_delete, isRedo);
}
void
TablespaceStorageInit(void (*unlink_tablespace_dir_function)(Oid tablespace_oid, bool is_redo))
{
unlink_tablespace_dir = unlink_tablespace_dir_function;
tablespace_storage_reset_on_abort();
tablespace_storage_reset_on_commit();
}
/*
* For abort:
*/
void
ScheduleTablespaceDirectoryDeletionForAbort(Oid tablespace_oid)
{
pending_tablespace_scheduled_for_deletion_on_abort = tablespace_oid;
}
Oid
GetPendingTablespaceForDeletionForAbort(void)
{
return pending_tablespace_scheduled_for_deletion_on_abort;
}
void
DoPendingTablespaceDeletionForAbort(void)
{
perform_pending_tablespace_deletion_internal(
GetPendingTablespaceForDeletionForAbort(),
false
);
tablespace_storage_reset_on_abort();
}
void
UnscheduleTablespaceDirectoryDeletionForAbort(void)
{
tablespace_storage_reset_on_abort();
}
/*
* For commit:
*/
void
ScheduleTablespaceDirectoryDeletionForCommit(Oid tablespaceoid)
{
pending_tablespace_scheduled_for_deletion_on_commit = tablespaceoid;
}
void
UnscheduleTablespaceDirectoryDeletionForCommit(void)
{
tablespace_storage_reset_on_commit();
}
Oid
GetPendingTablespaceForDeletionForCommit(void)
{
return pending_tablespace_scheduled_for_deletion_on_commit;
}
void
DoPendingTablespaceDeletionForCommit(void)
{
perform_pending_tablespace_deletion_internal(
GetPendingTablespaceForDeletionForCommit(),
false);
tablespace_storage_reset_on_commit();
}
/*
* For Xlog redo:
*
*/
void
DoTablespaceDeletionForRedoXlog(Oid tablespace_oid_to_delete)
{
perform_pending_tablespace_deletion_internal(tablespace_oid_to_delete, true);
}
相关信息
相关文章
0
赞
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦