Skip to content

Commit

Permalink
Fix yezzey_load_relation func & warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
reshke committed Oct 30, 2024
1 parent f9f3715 commit dac0f03
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
2 changes: 1 addition & 1 deletion include/storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ EXTERNC int offloadRelationSegment(Relation aorel, int segno, int64 modcount,
int64 logicalEof,
const char *external_storage_path);

EXTERNC int loadRelationSegment(Relation aorel, Oid origrelfilenode, int segno,
EXTERNC int loadRelationSegment(Relation aorel, Oid orig_relnode, int segno,
const char *dest_path);

EXTERNC bool ensureFileLocal(RelFileNode rnode, BackendId backend,
Expand Down
6 changes: 5 additions & 1 deletion include/xvacuum.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
EXTERNC int yezzey_delete_chunk_internal(const char *external_chunk_path);
EXTERNC int yezzey_vacuum_garbage_internal(int segindx, bool confirm,
bool crazyDrop);
EXTERNC int yezzey_vacuum_garbage_relation_internal(Oid reloid, int segindx, bool confirm,

EXTERNC int yezzey_vacuum_garbage_relation_internal(Relation rel, int segindx, bool confirm,
bool crazyDrop);

EXTERNC int yezzey_vacuum_garbage_relation_internal_oid(Oid reloid, int segindx, bool confirm,
bool crazyDrop);
#endif /* YEZZEY_XVACUUM_H */
2 changes: 1 addition & 1 deletion src/storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ int loadRelationSegment(Relation aorel, Oid orig_relnode, int segno,
if (dest_path) {
path = std::string(dest_path);
} else {
path = getlocalpath(coords);
path = getlocalpath(relnodeCoord(rnode.spcNode, rnode.dbNode, rnode.relNode, segno));
}

elog(yezzey_ao_log_level, "contructed path %s", path.c_str());
Expand Down
4 changes: 2 additions & 2 deletions src/xvacuum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ int yezzey_vacuum_garbage_internal(int segindx, bool confirm, bool crazyDrop) {
}
return 0;
}
int yezzey_vacuum_garbage_relation_internal(Relation rel,int segindx, bool confirm,bool crazyDrop){
int yezzey_vacuum_garbage_relation_internal(Relation rel, int segindx, bool confirm,bool crazyDrop){
try {
auto ioadv = std::make_shared<IOadv>("", "",
std::string(storage_class /*storage_class*/), multipart_chunksize,
Expand Down Expand Up @@ -107,7 +107,7 @@ int yezzey_vacuum_garbage_relation_internal(Relation rel,int segindx, bool confi
}
return 0;
}
int yezzey_vacuum_garbage_relation_internal(Oid reloid,int segindx, bool confirm, bool crazyDrop) {
int yezzey_vacuum_garbage_relation_internal_oid(Oid reloid,int segindx, bool confirm, bool crazyDrop) {
Relation rel = relation_open(reloid,NoLock);
int rc = yezzey_vacuum_garbage_relation_internal(rel,segindx,confirm,crazyDrop);
relation_close(rel,NoLock);
Expand Down
15 changes: 11 additions & 4 deletions yezzey.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,15 @@ int yezzey_offload_relation_internal(Oid reloid, bool remove_locally,

int yezzey_delete_chunk_internal(const char *external_chunk_path);
int yezzey_vacuum_garbage_internal(int segindx, bool confirm, bool crazyDrop);
int yezzey_vacuum_garbage_relation_internal(Oid reloid,int segindx, bool confirm, bool crazyDrop);
int yezzey_vacuum_garbage_relation_internal_oid(Oid reloid,int segindx, bool confirm, bool crazyDrop);
int yezzey_vacuum_garbage_relation_internal(Relation rel,int segindx, bool confirm, bool crazyDrop);

void yezzey_object_access_hook (ObjectAccessType access,
Oid classId,
Oid objectId,
int subId,
void *arg);

/*
* yezzey_define_relation_offload_policy_internal:
* do all the work with initial relation offloading
Expand Down Expand Up @@ -261,8 +269,7 @@ int yezzey_load_relation_internal(Oid reloid, const char *dest_path) {
elog(yezzey_log_level, "loading cs segment no %d pseudosegno %d", segno,
pseudosegno);

rc =
loadRelationSegment(aorel, origrelfilenode, pseudosegno, dest_path);
rc = loadRelationSegment(aorel, origrelfilenode, pseudosegno, dest_path);
if (rc < 0) {
elog(ERROR, "failed to load cs segment number %d pseudosegno %d",
segno, pseudosegno);
Expand Down Expand Up @@ -460,7 +467,7 @@ Datum yezzey_vacuum_relation(PG_FUNCTION_ARGS) {
elog(ERROR, "crazyDrop forbidden for non-superuser");
}

rc = yezzey_vacuum_garbage_relation_internal(reloid,GpIdentity.segindex,confirm,crazyDrop);
rc = yezzey_vacuum_garbage_relation_internal_oid(reloid, GpIdentity.segindex, confirm, crazyDrop);

PG_RETURN_VOID();

Expand Down

0 comments on commit dac0f03

Please sign in to comment.