1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-07 03:22:57 +03:00

Revert "MCOL-5057 Revert "Merge pull request #2326 from drrtuy/MCOL-4912-dev6"" (#2350)

This reverts commit c6d4c2a102.

Co-authored-by: Roman Nozdrin <rnozdrin@mariadb.com>
This commit is contained in:
Roman Nozdrin
2022-04-27 16:07:58 +02:00
committed by GitHub
parent 826a735f53
commit ff7759f71e
25 changed files with 3498 additions and 464 deletions

View File

@@ -24,24 +24,24 @@
* class BRMShmImpl
*/
#ifndef IDBSHMIMPL_H_
#define IDBSHMIMPL_H_
#pragma once
#include <unistd.h>
//#define NDEBUG
#include <cassert>
#include <boost/interprocess/shared_memory_object.hpp>
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/mapped_region.hpp>
namespace bi = boost::interprocess;
namespace BRM
{
class BRMShmImpl
class BRMShmImplParent
{
public:
BRMShmImpl(unsigned key, off_t size, bool readOnly = false);
~BRMShmImpl()
{
}
BRMShmImplParent(unsigned key, off_t size, bool readOnly = false);
virtual ~BRMShmImplParent();
inline unsigned key() const
{
@@ -56,25 +56,63 @@ class BRMShmImpl
return fReadOnly;
}
void setReadOnly();
int grow(unsigned newKey, off_t newSize);
int clear(unsigned newKey, off_t newSize);
void swap(BRMShmImpl& rhs);
void destroy();
boost::interprocess::shared_memory_object fShmobj;
boost::interprocess::mapped_region fMapreg;
private:
BRMShmImpl(const BRMShmImpl& rhs);
BRMShmImpl& operator=(const BRMShmImpl& rhs);
virtual void setReadOnly() = 0;
virtual int clear(unsigned newKey, off_t newSize) = 0;
virtual void destroy() = 0;
protected:
unsigned fKey;
off_t fSize;
bool fReadOnly;
};
} // namespace BRM
class BRMShmImpl : public BRMShmImplParent
{
public:
BRMShmImpl(unsigned key, off_t size, bool readOnly = false);
BRMShmImpl(const BRMShmImpl& rhs) = delete;
BRMShmImpl& operator=(const BRMShmImpl& rhs) = delete;
~BRMShmImpl()
{
}
#endif
int clear(unsigned newKey, off_t newSize) override;
void destroy() override;
void setReadOnly() override;
int grow(unsigned newKey, off_t newSize);
void swap(BRMShmImpl& rhs);
bi::shared_memory_object fShmobj;
bi::mapped_region fMapreg;
};
class BRMManagedShmImpl : public BRMShmImplParent
{
public:
BRMManagedShmImpl(unsigned key, off_t size, bool readOnly = false);
BRMManagedShmImpl(const BRMManagedShmImpl& rhs) = delete;
BRMManagedShmImpl& operator=(const BRMManagedShmImpl& rhs) = delete;
~BRMManagedShmImpl()
{
delete fShmSegment;
}
int clear(unsigned newKey, off_t newSize) override;
void destroy() override;
void setReadOnly() override;
int grow(off_t newSize);
void remap(const bool readOnly = false);
void swap(BRMManagedShmImpl& rhs);
bi::managed_shared_memory* getManagedSegment()
{
assert(fShmSegment);
return fShmSegment;
}
private:
bi::managed_shared_memory* fShmSegment;
};
} // namespace BRM