diff --git a/src/gausskernel/storage/mot/core/storage/sentinel/sentinel.h b/src/gausskernel/storage/mot/core/storage/sentinel/sentinel.h index bd5234151..f0f26e31d 100644 --- a/src/gausskernel/storage/mot/core/storage/sentinel/sentinel.h +++ b/src/gausskernel/storage/mot/core/storage/sentinel/sentinel.h @@ -261,7 +261,7 @@ public: m_refCount = m_refCount & (~S_COUNTER_LOCK_BIT); #else - uint64_t v = GetRefCount(); + uint32_t v = GetRefCount(); while (!__sync_bool_compare_and_swap(&m_refCount, v, (v & ~S_COUNTER_LOCK_BIT))) { PAUSE v = GetRefCount(); diff --git a/src/gausskernel/storage/mot/core/storage/table.h b/src/gausskernel/storage/mot/core/storage/table.h index fc14b7bf5..e468dbfa4 100644 --- a/src/gausskernel/storage/mot/core/storage/table.h +++ b/src/gausskernel/storage/mot/core/storage/table.h @@ -592,7 +592,7 @@ public: * @brief Retrieves the number of fields (columns) in each row in the table. * @return Number of fields in a row. */ - inline uint64_t GetFieldCount() const + inline uint32_t GetFieldCount() const { return m_fieldCnt; } diff --git a/src/gausskernel/storage/mot/core/system/checkpoint/checkpoint_utils.cpp b/src/gausskernel/storage/mot/core/system/checkpoint/checkpoint_utils.cpp index abe138efe..a1f17fe35 100644 --- a/src/gausskernel/storage/mot/core/system/checkpoint/checkpoint_utils.cpp +++ b/src/gausskernel/storage/mot/core/system/checkpoint/checkpoint_utils.cpp @@ -54,26 +54,6 @@ bool IsDirExists(const std::string& dirName) return true; } -bool OpenFileWrite(const std::string& fileName, FILE*& pFile) -{ - pFile = fopen(fileName.c_str(), "wb"); - if (pFile == nullptr) { - MOT_REPORT_SYSTEM_ERROR(fopen, "N/A", "Failed to open file %s for writing", fileName.c_str()); - return false; - } - return true; -} - -bool OpenFileRead(const std::string& fileName, FILE*& pFile) -{ - pFile = fopen(fileName.c_str(), "rb"); - if (pFile == nullptr) { - MOT_REPORT_SYSTEM_ERROR(fopen, "N/A", "Failed to open file %s for reading", fileName.c_str()); - return false; - } - return true; -} - bool OpenFileWrite(const std::string& fileName, int& fd) { fd = open(fileName.c_str(), O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR); /* 0600 */ @@ -132,9 +112,9 @@ int FlushFile(int fd) return rc; } -bool SeekFile(int fd, uint64_t offset) +bool SeekFile(int fd, off64_t offset) { - int rc = lseek(fd, offset, SEEK_SET); + int rc = lseek64(fd, offset, SEEK_SET); if (rc == -1) { MOT_REPORT_SYSTEM_ERROR(write, "N/A", "Failed to seek file descriptor %d to offset %" PRIu64, fd); } diff --git a/src/gausskernel/storage/mot/core/system/checkpoint/checkpoint_utils.h b/src/gausskernel/storage/mot/core/system/checkpoint/checkpoint_utils.h index 0122afa27..6e7cd38ac 100644 --- a/src/gausskernel/storage/mot/core/system/checkpoint/checkpoint_utils.h +++ b/src/gausskernel/storage/mot/core/system/checkpoint/checkpoint_utils.h @@ -77,22 +77,6 @@ bool IsFileExists(const std::string& fileName); */ bool IsDirExists(const std::string& dirName); -/** - * @brief A wrapper function that opens a file for writing. - * @param fileName The file name to open - * @param pFile The returned FILE* pointer - * @return Boolean value denoting success or failure. - */ -bool OpenFileWrite(const std::string& fileName, FILE*& pFile); - -/** - * @brief A wrapper function that opens a file for reading. - * @param fileName The file name to open - * @param pFile The returned FILE* pointer - * @return Boolean value denoting success or failure. - */ -bool OpenFileRead(const std::string& fileName, FILE*& pFile); - /** * @brief A wrapper function that opens a file for writing. * @param fileName The file name to open @@ -147,7 +131,7 @@ int FlushFile(int fd); * @param offset The offset in the file to seek to. * @return Boolean value denoting success or failure. */ -bool SeekFile(int fd, uint64_t offset); +bool SeekFile(int fd, off64_t offset); /** * @brief Frees a row's stable version row. diff --git a/src/gausskernel/storage/mot/core/system/transaction/txn.cpp b/src/gausskernel/storage/mot/core/system/transaction/txn.cpp index cd9207f88..b245819aa 100644 --- a/src/gausskernel/storage/mot/core/system/transaction/txn.cpp +++ b/src/gausskernel/storage/mot/core/system/transaction/txn.cpp @@ -2008,11 +2008,11 @@ RC TxnIxColUpdate::InitAndBuildOldKeys(Row* row) for (uint64_t i = 0; i < m_cols; i++) { if (BITMAP_GET(m_modBitmap, i)) { - if (m_tab->GetField((uint16_t)(i + 1))->IsUsedByIndex()) { + if (m_tab->GetField((i + 1))->IsUsedByIndex()) { for (uint16_t j = 0; j < m_arrLen; j++) { if (m_ix[j] == nullptr) { MOT::Index* ix = m_tab->GetIndex(j); - if (ix->IsFieldPresent((uint16_t)(i + 1))) { + if (ix->IsFieldPresent(static_cast(i + 1))) { m_ix[j] = ix; } } diff --git a/src/gausskernel/storage/mot/fdw_adapter/mot_internal.cpp b/src/gausskernel/storage/mot/fdw_adapter/mot_internal.cpp index cca2f11ab..c1ae61c18 100644 --- a/src/gausskernel/storage/mot/fdw_adapter/mot_internal.cpp +++ b/src/gausskernel/storage/mot/fdw_adapter/mot_internal.cpp @@ -940,7 +940,7 @@ MOT::RC MOTAdaptor::CreateIndex(IndexStmt* stmt, ::TransactionId tid) stmt->idxname, stmt->indexOid, stmt->relation->relname); - uint64_t keyLength = 0; + uint32_t keyLength = 0; MOT::Index* index = nullptr; MOT::IndexOrder index_order = MOT::IndexOrder::INDEX_ORDER_SECONDARY; @@ -964,7 +964,7 @@ MOT::RC MOTAdaptor::CreateIndex(IndexStmt* stmt, ::TransactionId tid) return MOT::RC_ABORT; } index->SetExtId(stmt->indexOid); - if (!index->SetNumTableFields((uint32_t)table->GetFieldCount())) { + if (!index->SetNumTableFields(table->GetFieldCount())) { table->GetOrigTable()->Unlock(); delete index; report_pg_error(MOT::RC_ABORT);