Skip to content

Commit 7e3aa77

Browse files
committed
Fix compiling errors for pax storage
1 parent db950d8 commit 7e3aa77

28 files changed

Lines changed: 127 additions & 124 deletions

contrib/pax_storage/src/cpp/access/pax_access_handle.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ TM_Result CCPaxAccessMethod::TupleUpdate(Relation relation, ItemPointer otid,
264264
Snapshot snapshot, Snapshot crosscheck,
265265
bool wait, TM_FailureData *tmfd,
266266
LockTupleMode *lockmode,
267-
bool *update_indexes) {
267+
TU_UpdateIndexes *update_indexes) {
268268
CBDB_TRY();
269269
{
270270
MemoryContext old_ctx;
@@ -276,7 +276,7 @@ TM_Result CCPaxAccessMethod::TupleUpdate(Relation relation, ItemPointer otid,
276276
crosscheck, wait, tmfd, lockmode,
277277
update_indexes);
278278
MemoryContextSwitchTo(old_ctx);
279-
if (result == TM_Ok) pgstat_count_heap_update(relation, false);
279+
if (result == TM_Ok) pgstat_count_heap_update(relation, false, false);
280280
return result;
281281
}
282282
CBDB_CATCH_DEFAULT();
@@ -765,7 +765,7 @@ static const TableAmRoutine kPaxColumnMethods = {
765765
.tuple_lock = paxc::PaxAccessMethod::TupleLock,
766766
.finish_bulk_insert = pax::CCPaxAccessMethod::FinishBulkInsert,
767767

768-
.relation_set_new_filenode = pax::CCPaxAccessMethod::RelationSetNewFilenode,
768+
.relation_set_new_filelocator = pax::CCPaxAccessMethod::RelationSetNewFilenode,
769769
.relation_nontransactional_truncate =
770770
pax::CCPaxAccessMethod::RelationNontransactionalTruncate,
771771
.relation_copy_data = pax::CCPaxAccessMethod::RelationCopyData,

contrib/pax_storage/src/cpp/access/pax_access_handle.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ class CCPaxAccessMethod final {
152152
TupleTableSlot *slot, CommandId cid,
153153
Snapshot snapshot, Snapshot crosscheck,
154154
bool wait, TM_FailureData *tmfd,
155-
LockTupleMode *lockmode, bool *update_indexes);
155+
LockTupleMode *lockmode, TU_UpdateIndexes *update_indexes);
156156

157-
static void RelationCopyData(Relation rel, const RelFileNode *newrnode);
157+
static void RelationCopyData(Relation rel, const RelFileLocator *newrnode);
158158

159159
static void RelationCopyForCluster(Relation old_heap, Relation new_heap,
160160
Relation old_index, bool use_sort,
@@ -164,7 +164,8 @@ class CCPaxAccessMethod final {
164164
double *num_tuples, double *tups_vacuumed,
165165
double *tups_recently_dead);
166166

167-
static void RelationSetNewFilenode(Relation rel, const RelFileNode *newrnode,
167+
static void RelationSetNewFilenode(Relation rel,
168+
const RelFileLocator *newrlocator,
168169
char persistence,
169170
TransactionId *freeze_xid,
170171
MultiXactId *minmulti);

contrib/pax_storage/src/cpp/access/pax_access_method_internal.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ void PaxAccessMethod::SwapRelationFiles(Oid relid1, Oid relid2,
189189
namespace pax {
190190

191191
void CCPaxAccessMethod::RelationSetNewFilenode(Relation rel,
192-
const RelFileNode *newrnode,
192+
const RelFileLocator *newrlocator,
193193
char persistence,
194194
TransactionId *freeze_xid,
195195
MultiXactId *minmulti) {
@@ -241,22 +241,22 @@ void CCPaxAccessMethod::RelationSetNewFilenode(Relation rel,
241241
table_close(pax_tables_rel, NoLock);
242242

243243
// create relfilenode file for pax table
244-
auto srel = paxc::PaxRelationCreateStorage(*newrnode, rel);
244+
auto srel = paxc::PaxRelationCreateStorage(*newrlocator, rel);
245245
smgrclose(srel);
246246

247247
// create data directory
248248
CBDB_TRY();
249249
{
250250
FileSystem *fs = pax::Singleton<LocalFileSystem>::GetInstance();
251-
auto path = cbdb::BuildPaxDirectoryPath(*newrnode, rel->rd_backend);
251+
auto path = cbdb::BuildPaxDirectoryPath(*newrlocator, rel->rd_backend);
252252
Assert(!path.empty());
253253
CBDB_CHECK(
254254
(fs->CreateDirectory(path) == 0),
255255
cbdb::CException::ExType::kExTypeIOError,
256256
fmt("Create directory failed [path=%s, errno=%d], "
257257
"relfilenode [spcNode=%u, dbNode=%u, relNode=%u, backend=%d]",
258-
path.c_str(), errno, newrnode->spcNode, newrnode->dbNode,
259-
newrnode->relNode, rel->rd_backend));
258+
path.c_str(), errno, newrlocator->spcOid, newrlocator->dbOid,
259+
newrlocator->relNumber, rel->rd_backend));
260260
}
261261
CBDB_CATCH_DEFAULT();
262262
CBDB_FINALLY({});
@@ -277,7 +277,7 @@ void CCPaxAccessMethod::RelationNontransactionalTruncate(Relation rel) {
277277
}
278278

279279
void CCPaxAccessMethod::RelationCopyData(Relation rel,
280-
const RelFileNode *newrnode) {
280+
const RelFileLocator *newrnode) {
281281
CBDB_TRY();
282282
{
283283
cbdb::RelOpenSmgr(rel);

contrib/pax_storage/src/cpp/access/pax_deleter.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ std::unique_ptr<IteratorBase<MicroPartitionMetadata>>
119119
CPaxDeleter::BuildDeleteIterator() {
120120
std::vector<pax::MicroPartitionMetadata> micro_partitions;
121121
auto rel_path = cbdb::BuildPaxDirectoryPath(
122-
rel_->rd_node, rel_->rd_backend);
122+
rel_->rd_locator, rel_->rd_backend);
123123
for (auto &it : block_bitmap_map_) {
124124
std::string block_id = std::to_string(it.first);
125125
{

contrib/pax_storage/src/cpp/access/pax_scanner.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ PaxIndexScanDesc::PaxIndexScanDesc(Relation rel) : base_{.rel = rel} {
112112
Assert(rel);
113113
Assert(&base_ == reinterpret_cast<IndexFetchTableData *>(this));
114114
rel_path_ = cbdb::BuildPaxDirectoryPath(
115-
rel->rd_node, rel->rd_backend);
115+
rel->rd_locator, rel->rd_backend);
116116
}
117117

118118
PaxIndexScanDesc::~PaxIndexScanDesc() {}

contrib/pax_storage/src/cpp/access/pax_updater.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ TM_Result CPaxUpdater::UpdateTuple(
3636
const Relation relation, const ItemPointer otid, TupleTableSlot *slot,
3737
const CommandId cid, const Snapshot snapshot, const Snapshot /*crosscheck*/,
3838
const bool /*wait*/, TM_FailureData * tmfd,
39-
LockTupleMode * lockmode, bool *update_indexes) {
39+
LockTupleMode * lockmode, TU_UpdateIndexes *update_indexes) {
4040
TM_Result result;
4141

4242
auto dml_state = CPaxDmlStateLocal::Instance();
@@ -51,12 +51,12 @@ TM_Result CPaxUpdater::UpdateTuple(
5151

5252
if (result == TM_Ok) {
5353
inserter->InsertTuple(relation, slot, cid, 0, nullptr);
54-
*update_indexes = true;
54+
*update_indexes = TU_All;
5555
} else {
5656
// FIXME: set tmfd correctly.
5757
// FYI, ao ignores both tmfd and lockmode
5858
tmfd->ctid = *otid;
59-
*update_indexes = false;
59+
*update_indexes = TU_None;
6060
}
6161
// TODO(gongxun): update pgstat info
6262
return result;

contrib/pax_storage/src/cpp/access/pax_updater.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ class CPaxUpdater final {
3737
const Snapshot snapshot,
3838
const Snapshot crosscheck, const bool wait,
3939
TM_FailureData *tmfd, LockTupleMode *lockmode,
40-
bool *update_indexes);
40+
TU_UpdateIndexes *update_indexes);
4141
};
4242
} // namespace pax

contrib/pax_storage/src/cpp/access/pax_visimap.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ std::shared_ptr<std::vector<uint8>> LoadVisimap(
138138
bool TestVisimap(Relation rel, const char *visimap_name, int offset) {
139139
FileSystem *fs;
140140
std::shared_ptr<FileSystemOptions> options;
141-
auto rel_path = cbdb::BuildPaxDirectoryPath(rel->rd_node, rel->rd_backend);
141+
auto rel_path = cbdb::BuildPaxDirectoryPath(rel->rd_locator, rel->rd_backend);
142142
auto file_path = cbdb::BuildPaxFilePath(rel_path, visimap_name);
143143
fs = Singleton<LocalFileSystem>::GetInstance();
144144

contrib/pax_storage/src/cpp/catalog/pax_aux_table.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -492,13 +492,13 @@ void PaxAuxRelationSetNewFilenode(Oid aux_relid) {
492492
ReindexParams reindex_params = {0};
493493

494494
aux_rel = relation_open(aux_relid, AccessExclusiveLock);
495-
RelationSetNewRelfilenode(aux_rel, aux_rel->rd_rel->relpersistence);
495+
RelationSetNewRelfilenumber(aux_rel, aux_rel->rd_rel->relpersistence);
496496
toastrelid = aux_rel->rd_rel->reltoastrelid;
497497

498498
if (OidIsValid(toastrelid)) {
499499
Relation toast_rel;
500500
toast_rel = relation_open(toastrelid, AccessExclusiveLock);
501-
RelationSetNewRelfilenode(toast_rel, toast_rel->rd_rel->relpersistence);
501+
RelationSetNewRelfilenumber(toast_rel, toast_rel->rd_rel->relpersistence);
502502
relation_close(toast_rel, NoLock);
503503
}
504504

@@ -630,7 +630,7 @@ static void FetchMicroPartitionAuxRowCallback(Datum *values, bool *isnull,
630630
auto ctx = reinterpret_cast<struct FetchMicroPartitionAuxRowContext *>(arg);
631631
auto rel = ctx->rel;
632632
auto rel_path = cbdb::BuildPaxDirectoryPath(
633-
rel->rd_node, rel->rd_backend);
633+
rel->rd_locator, rel->rd_backend);
634634

635635
Assert(!isnull[ANUM_PG_PAX_BLOCK_TABLES_PTBLOCKNAME]);
636636
{
@@ -738,24 +738,24 @@ void CCPaxAuxTable::PaxAuxRelationNontransactionalTruncate(Relation rel) {
738738
// Delete all micro partition file on non-transactional truncate but reserve
739739
// top level PAX file directory.
740740
PaxAuxRelationFileUnlink(
741-
rel->rd_node, rel->rd_backend, false,
741+
rel->rd_locator, rel->rd_backend, false,
742742
rel->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT);
743743
}
744744

745745
void CCPaxAuxTable::PaxAuxRelationCopyData(Relation rel,
746-
const RelFileNode *newrnode,
746+
const RelFileLocator *newrnode,
747747
bool createnewpath) {
748748
PaxCopyAllDataFiles(rel, newrnode, createnewpath);
749749
}
750750

751751
void CCPaxAuxTable::PaxAuxRelationCopyDataForCluster(Relation old_rel,
752752
Relation new_rel) {
753-
PaxAuxRelationCopyData(old_rel, &new_rel->rd_node, false);
753+
PaxAuxRelationCopyData(old_rel, &new_rel->rd_locator, false);
754754
cbdb::PaxCopyPaxBlockEntry(old_rel, new_rel);
755755
// TODO(Tony) : here need to implement PAX re-organize semantics logic.
756756
}
757757

758-
void CCPaxAuxTable::PaxAuxRelationFileUnlink(RelFileNode node,
758+
void CCPaxAuxTable::PaxAuxRelationFileUnlink(RelFileLocator node,
759759
BackendId backend,
760760
bool delete_topleveldir,
761761
bool need_wal) {

contrib/pax_storage/src/cpp/catalog/pax_aux_table.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,18 @@ class CCPaxAuxTable final {
9696
~CCPaxAuxTable() = delete;
9797

9898
static void PaxAuxRelationSetNewFilenode(Relation rel,
99-
const RelFileNode *newrnode,
99+
const RelFileLocator *newrnode,
100100
char persistence);
101101

102102
static void PaxAuxRelationNontransactionalTruncate(Relation rel);
103103

104-
static void PaxAuxRelationCopyData(Relation rel, const RelFileNode *newrnode,
104+
static void PaxAuxRelationCopyData(Relation rel, const RelFileLocator *newrnode,
105105
bool createnewpath = true);
106106

107107
static void PaxAuxRelationCopyDataForCluster(Relation old_rel,
108108
Relation new_rel);
109109

110-
static void PaxAuxRelationFileUnlink(RelFileNode node, BackendId backend,
110+
static void PaxAuxRelationFileUnlink(RelFileLocator node, BackendId backend,
111111
bool delete_topleveldir, bool need_wal);
112112
};
113113

0 commit comments

Comments
 (0)