You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
Reformat all code to coding standard
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -33,17 +33,18 @@ namespace primitives
|
||||
{
|
||||
|
||||
PrimitiveProcessor::PrimitiveProcessor(int debugLevel) :
|
||||
fDebugLevel(debugLevel), fStatsPtr(NULL), logicalBlockMode(false)
|
||||
fDebugLevel(debugLevel), fStatsPtr(NULL), logicalBlockMode(false)
|
||||
{
|
||||
|
||||
// This does
|
||||
// masks[11] = { 0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023 };
|
||||
int acc, i;
|
||||
int acc, i;
|
||||
|
||||
for (acc = 0, i = 0; i < 11; i++) {
|
||||
masks[i] = acc;
|
||||
acc = acc << 1 | 1;
|
||||
}
|
||||
for (acc = 0, i = 0; i < 11; i++)
|
||||
{
|
||||
masks[i] = acc;
|
||||
acc = acc << 1 | 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -54,7 +55,7 @@ PrimitiveProcessor::~PrimitiveProcessor()
|
||||
|
||||
void PrimitiveProcessor::setParsedColumnFilter(boost::shared_ptr<ParsedColumnFilter> pcf)
|
||||
{
|
||||
parsedColumnFilter = pcf;
|
||||
parsedColumnFilter = pcf;
|
||||
}
|
||||
|
||||
ParsedColumnFilter::ParsedColumnFilter() : columnFilterMode(STANDARD), likeOps(0)
|
||||
|
@ -57,28 +57,29 @@ class PrimTest;
|
||||
namespace primitives
|
||||
{
|
||||
|
||||
enum ColumnFilterMode {
|
||||
STANDARD,
|
||||
TWO_ARRAYS,
|
||||
UNORDERED_SET
|
||||
enum ColumnFilterMode
|
||||
{
|
||||
STANDARD,
|
||||
TWO_ARRAYS,
|
||||
UNORDERED_SET
|
||||
};
|
||||
|
||||
class pcfHasher
|
||||
{
|
||||
public:
|
||||
inline size_t operator()(const int64_t i) const
|
||||
{
|
||||
return i;
|
||||
}
|
||||
public:
|
||||
inline size_t operator()(const int64_t i) const
|
||||
{
|
||||
return i;
|
||||
}
|
||||
};
|
||||
|
||||
class pcfEqual
|
||||
{
|
||||
public:
|
||||
inline size_t operator()(const int64_t f1, const int64_t f2) const
|
||||
{
|
||||
return f1 == f2;
|
||||
}
|
||||
public:
|
||||
inline size_t operator()(const int64_t f1, const int64_t f2) const
|
||||
{
|
||||
return f1 == f2;
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::tr1::unordered_set<int64_t, pcfHasher, pcfEqual> prestored_set_t;
|
||||
@ -87,41 +88,46 @@ typedef std::tr1::unordered_set<std::string, utils::Hasher> DictEqualityFilter;
|
||||
struct idb_regex_t
|
||||
{
|
||||
#ifdef POSIX_REGEX
|
||||
regex_t regex;
|
||||
regex_t regex;
|
||||
#else
|
||||
boost::regex regex;
|
||||
boost::regex regex;
|
||||
#endif
|
||||
bool used;
|
||||
idb_regex_t() : used(false) { }
|
||||
~idb_regex_t() {
|
||||
bool used;
|
||||
idb_regex_t() : used(false) { }
|
||||
~idb_regex_t()
|
||||
{
|
||||
#ifdef POSIX_REGEX
|
||||
if (used)
|
||||
regfree(®ex);
|
||||
|
||||
if (used)
|
||||
regfree(®ex);
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct ParsedColumnFilter {
|
||||
ColumnFilterMode columnFilterMode;
|
||||
boost::shared_array<int64_t> prestored_argVals;
|
||||
boost::shared_array<uint8_t> prestored_cops;
|
||||
boost::shared_array<uint8_t> prestored_rfs;
|
||||
boost::shared_ptr<prestored_set_t> prestored_set;
|
||||
boost::shared_array<idb_regex_t> prestored_regex;
|
||||
uint8_t likeOps;
|
||||
struct ParsedColumnFilter
|
||||
{
|
||||
ColumnFilterMode columnFilterMode;
|
||||
boost::shared_array<int64_t> prestored_argVals;
|
||||
boost::shared_array<uint8_t> prestored_cops;
|
||||
boost::shared_array<uint8_t> prestored_rfs;
|
||||
boost::shared_ptr<prestored_set_t> prestored_set;
|
||||
boost::shared_array<idb_regex_t> prestored_regex;
|
||||
uint8_t likeOps;
|
||||
|
||||
ParsedColumnFilter();
|
||||
~ParsedColumnFilter();
|
||||
ParsedColumnFilter();
|
||||
~ParsedColumnFilter();
|
||||
};
|
||||
|
||||
//@bug 1828 These need to be public so that column operations can use it for 'like'
|
||||
struct p_DataValue {
|
||||
int len;
|
||||
const uint8_t *data;
|
||||
struct p_DataValue
|
||||
{
|
||||
int len;
|
||||
const uint8_t* data;
|
||||
};
|
||||
|
||||
boost::shared_ptr<ParsedColumnFilter> parseColumnFilter(const uint8_t *filterString,
|
||||
uint32_t colWidth, uint32_t colType, uint32_t filterCount, uint32_t BOP);
|
||||
boost::shared_ptr<ParsedColumnFilter> parseColumnFilter(const uint8_t* filterString,
|
||||
uint32_t colWidth, uint32_t colType, uint32_t filterCount, uint32_t BOP);
|
||||
|
||||
/** @brief This class encapsulates the primitive processing functionality of the system.
|
||||
*
|
||||
@ -130,190 +136,196 @@ boost::shared_ptr<ParsedColumnFilter> parseColumnFilter(const uint8_t *filterStr
|
||||
class PrimitiveProcessor
|
||||
{
|
||||
public:
|
||||
PrimitiveProcessor(int debugLevel=0);
|
||||
virtual ~PrimitiveProcessor();
|
||||
PrimitiveProcessor(int debugLevel = 0);
|
||||
virtual ~PrimitiveProcessor();
|
||||
|
||||
/** @brief Sets the block to operate on
|
||||
*
|
||||
* The primitive processing functions operate on one block at a time. The caller
|
||||
* sets which block to operate on next with this function.
|
||||
*/
|
||||
void setBlockPtr(int *data)
|
||||
/** @brief Sets the block to operate on
|
||||
*
|
||||
* The primitive processing functions operate on one block at a time. The caller
|
||||
* sets which block to operate on next with this function.
|
||||
*/
|
||||
void setBlockPtr(int* data)
|
||||
{
|
||||
block = data;
|
||||
block = data;
|
||||
}
|
||||
void setPMStatsPtr(dbbc::Stats* p)
|
||||
{
|
||||
fStatsPtr = p;
|
||||
}
|
||||
void setPMStatsPtr(dbbc::Stats* p)
|
||||
{
|
||||
fStatsPtr=p;
|
||||
}
|
||||
|
||||
|
||||
/** @brief The interface to Mark's NIOS primitive processing code.
|
||||
*
|
||||
* The interface to Mark's NIOS primitive processing code. Instead of reading
|
||||
* and writing to a bus, it will read/write to buffers specified by inBuf
|
||||
* and outBuf. The primitives implemented this way are:
|
||||
* - p_Col and p_ColAggregate
|
||||
* - p_GetSignature
|
||||
*
|
||||
* @param inBuf (in) The buffer containing a command to execute
|
||||
* @param inLength (in) The size of inBuf in 4-byte words
|
||||
* @param outBuf (in) The buffer to store the output in
|
||||
* @param outLength (in) The size of outBuf in 4-byte words
|
||||
* @param written (out) The number of bytes written to outBuf.
|
||||
* @note Throws logic_error if the output buffer is too small for the result.
|
||||
*/
|
||||
void processBuffer(int *inBuf, unsigned inLength, int *outBuf, unsigned outLength,
|
||||
unsigned *written);
|
||||
/** @brief The interface to Mark's NIOS primitive processing code.
|
||||
*
|
||||
* The interface to Mark's NIOS primitive processing code. Instead of reading
|
||||
* and writing to a bus, it will read/write to buffers specified by inBuf
|
||||
* and outBuf. The primitives implemented this way are:
|
||||
* - p_Col and p_ColAggregate
|
||||
* - p_GetSignature
|
||||
*
|
||||
* @param inBuf (in) The buffer containing a command to execute
|
||||
* @param inLength (in) The size of inBuf in 4-byte words
|
||||
* @param outBuf (in) The buffer to store the output in
|
||||
* @param outLength (in) The size of outBuf in 4-byte words
|
||||
* @param written (out) The number of bytes written to outBuf.
|
||||
* @note Throws logic_error if the output buffer is too small for the result.
|
||||
*/
|
||||
void processBuffer(int* inBuf, unsigned inLength, int* outBuf, unsigned outLength,
|
||||
unsigned* written);
|
||||
|
||||
/* Patrick */
|
||||
/* Patrick */
|
||||
|
||||
/** @brief The p_TokenByScan primitive processor
|
||||
*
|
||||
* The p_TokenByScan primitive processor. It relies on the caller setting
|
||||
* the block to operate on with setBlockPtr(). It assumes the continuation
|
||||
* pointer is not used.
|
||||
* @param t (in) The arguments to the primitive
|
||||
* @param out (out) This must point to memory of some currently unknown max size
|
||||
* @param outSize (in) The size of the output buffer in bytes.
|
||||
* @note Throws logic_error if the output buffer is too small for the result.
|
||||
*/
|
||||
void p_TokenByScan(const TokenByScanRequestHeader *t,
|
||||
TokenByScanResultHeader *out, unsigned outSize,bool utf8,
|
||||
boost::shared_ptr<DictEqualityFilter> eqFilter);
|
||||
/** @brief The p_TokenByScan primitive processor
|
||||
*
|
||||
* The p_TokenByScan primitive processor. It relies on the caller setting
|
||||
* the block to operate on with setBlockPtr(). It assumes the continuation
|
||||
* pointer is not used.
|
||||
* @param t (in) The arguments to the primitive
|
||||
* @param out (out) This must point to memory of some currently unknown max size
|
||||
* @param outSize (in) The size of the output buffer in bytes.
|
||||
* @note Throws logic_error if the output buffer is too small for the result.
|
||||
*/
|
||||
void p_TokenByScan(const TokenByScanRequestHeader* t,
|
||||
TokenByScanResultHeader* out, unsigned outSize, bool utf8,
|
||||
boost::shared_ptr<DictEqualityFilter> eqFilter);
|
||||
|
||||
/** @brief The p_IdxWalk primitive processor
|
||||
*
|
||||
* The p_IdxWalk primitive processor. The caller must set the block to operate
|
||||
* on with setBlockPtr(). This primitive can return intermediate results.
|
||||
* All results returned will have an different LBID than the input. They can
|
||||
* also be in varying states of completion. A result is final when
|
||||
* Shift >= SSlen, otherwise it is intermediate and needs to be reissued with
|
||||
* the specified LBID loaded.
|
||||
* @note If in->NVALS > 2, new vectors may be returned in the result set, which
|
||||
* will have to be deleted by the caller. The test to use right now is
|
||||
* ({element}->NVALS > 2 && {element}->State == 0). If that condition is true,
|
||||
* delete the vector, otherwise don't. This kludginess is for efficiency's sake
|
||||
* and may go away for the sake of sanity later.
|
||||
* @note It is safe to delete any vector passed in after the call.
|
||||
* @param out The caller should pass in an empty vector. The results
|
||||
* will be returned as elements of this vector.
|
||||
*/
|
||||
void p_IdxWalk(const IndexWalkHeader *in, std::vector<IndexWalkHeader *> *out) throw();
|
||||
/** @brief The p_IdxWalk primitive processor
|
||||
*
|
||||
* The p_IdxWalk primitive processor. The caller must set the block to operate
|
||||
* on with setBlockPtr(). This primitive can return intermediate results.
|
||||
* All results returned will have an different LBID than the input. They can
|
||||
* also be in varying states of completion. A result is final when
|
||||
* Shift >= SSlen, otherwise it is intermediate and needs to be reissued with
|
||||
* the specified LBID loaded.
|
||||
* @note If in->NVALS > 2, new vectors may be returned in the result set, which
|
||||
* will have to be deleted by the caller. The test to use right now is
|
||||
* ({element}->NVALS > 2 && {element}->State == 0). If that condition is true,
|
||||
* delete the vector, otherwise don't. This kludginess is for efficiency's sake
|
||||
* and may go away for the sake of sanity later.
|
||||
* @note It is safe to delete any vector passed in after the call.
|
||||
* @param out The caller should pass in an empty vector. The results
|
||||
* will be returned as elements of this vector.
|
||||
*/
|
||||
void p_IdxWalk(const IndexWalkHeader* in, std::vector<IndexWalkHeader*>* out) throw();
|
||||
|
||||
/** @brief The p_IdxList primitive processor.
|
||||
*
|
||||
* The p_IdxList primitive processor. The caller must set the block to operate
|
||||
* on with setBlockPtr(). This primitive can return one intermediate result
|
||||
* for every call made. If there is an intermediate result returned, it will
|
||||
* be the first element, distinguished by its type field. If the
|
||||
* first element has a type == RID (3) , there is no intermediate result. If
|
||||
* the first element had a type == LLP_SUBBLK (4) or type == LLP_BLK (5),
|
||||
* that element is the intermediate result. Its value field will be a pointer
|
||||
* to the next section of the list.
|
||||
*
|
||||
* @param rqst (in) The request header followed by NVALS IndexWalkParams
|
||||
* @param rslt (out) The caller passes in a buffer which will be filled
|
||||
* by the primitive on return. It will consist of an IndexListHeader,
|
||||
* followed by NVALS IndexListEntrys.
|
||||
* @param mode (optional, in) 0 specifies old behavior (the last entry of a block might
|
||||
* be a pointer). 1 specifies new behavior (the last entry should be ignored).
|
||||
*/
|
||||
void p_IdxList(const IndexListHeader *rqst, IndexListHeader *rslt, int mode = 1);
|
||||
/** @brief The p_IdxList primitive processor.
|
||||
*
|
||||
* The p_IdxList primitive processor. The caller must set the block to operate
|
||||
* on with setBlockPtr(). This primitive can return one intermediate result
|
||||
* for every call made. If there is an intermediate result returned, it will
|
||||
* be the first element, distinguished by its type field. If the
|
||||
* first element has a type == RID (3) , there is no intermediate result. If
|
||||
* the first element had a type == LLP_SUBBLK (4) or type == LLP_BLK (5),
|
||||
* that element is the intermediate result. Its value field will be a pointer
|
||||
* to the next section of the list.
|
||||
*
|
||||
* @param rqst (in) The request header followed by NVALS IndexWalkParams
|
||||
* @param rslt (out) The caller passes in a buffer which will be filled
|
||||
* by the primitive on return. It will consist of an IndexListHeader,
|
||||
* followed by NVALS IndexListEntrys.
|
||||
* @param mode (optional, in) 0 specifies old behavior (the last entry of a block might
|
||||
* be a pointer). 1 specifies new behavior (the last entry should be ignored).
|
||||
*/
|
||||
void p_IdxList(const IndexListHeader* rqst, IndexListHeader* rslt, int mode = 1);
|
||||
|
||||
/** @brief The p_AggregateSignature primitive processor.
|
||||
*
|
||||
* The p_AggregateSignature primitive processor. It operates on a dictionary
|
||||
* block and assumes the continuation pointer is not used.
|
||||
* @param in The input parameters
|
||||
* @param out A pointer to a buffer where the result will be written.
|
||||
* @param outSize The size of the output buffer in bytes.
|
||||
* @param written (out parameter) A pointer to 1 int, which will contain the
|
||||
* number of bytes written to out.
|
||||
*/
|
||||
void p_AggregateSignature(const AggregateSignatureRequestHeader *in,
|
||||
AggregateSignatureResultHeader *out, unsigned outSize, unsigned *written, bool utf8);
|
||||
/** @brief The p_AggregateSignature primitive processor.
|
||||
*
|
||||
* The p_AggregateSignature primitive processor. It operates on a dictionary
|
||||
* block and assumes the continuation pointer is not used.
|
||||
* @param in The input parameters
|
||||
* @param out A pointer to a buffer where the result will be written.
|
||||
* @param outSize The size of the output buffer in bytes.
|
||||
* @param written (out parameter) A pointer to 1 int, which will contain the
|
||||
* number of bytes written to out.
|
||||
*/
|
||||
void p_AggregateSignature(const AggregateSignatureRequestHeader* in,
|
||||
AggregateSignatureResultHeader* out, unsigned outSize, unsigned* written, bool utf8);
|
||||
|
||||
/** @brief The p_Col primitive processor.
|
||||
*
|
||||
* The p_Col primitive processor. It operates on a column block specified using setBlockPtr().
|
||||
* @param in The buffer containing the command parameters.
|
||||
* The buffer should begin with a NewColRequestHeader structure, followed by
|
||||
* an array of 'NOPS' defining the filter to apply (optional),
|
||||
* followed by an array of RIDs to apply the filter to (optional).
|
||||
* @param out The buffer that will contain the results. On return, it will start with
|
||||
* a NewColResultHeader, followed by the output type specified by in->OutputType.
|
||||
* \li If OT_RID, it will be an array of RIDs
|
||||
* \li If OT_DATAVALUE, it will be an array of matching data values stored in the column
|
||||
* \li If OT_BOTH, it will be an array of <DataValue, RID> pairs
|
||||
* @param outSize The size of the output buffer in bytes.
|
||||
* @param written (out parameter) A pointer to 1 int, which will contain the
|
||||
* number of bytes written to out.
|
||||
* @note See PrimitiveMsg.h for the type definitions.
|
||||
*/
|
||||
void p_Col(NewColRequestHeader *in, NewColResultHeader *out, unsigned outSize,
|
||||
unsigned *written);
|
||||
/** @brief The p_Col primitive processor.
|
||||
*
|
||||
* The p_Col primitive processor. It operates on a column block specified using setBlockPtr().
|
||||
* @param in The buffer containing the command parameters.
|
||||
* The buffer should begin with a NewColRequestHeader structure, followed by
|
||||
* an array of 'NOPS' defining the filter to apply (optional),
|
||||
* followed by an array of RIDs to apply the filter to (optional).
|
||||
* @param out The buffer that will contain the results. On return, it will start with
|
||||
* a NewColResultHeader, followed by the output type specified by in->OutputType.
|
||||
* \li If OT_RID, it will be an array of RIDs
|
||||
* \li If OT_DATAVALUE, it will be an array of matching data values stored in the column
|
||||
* \li If OT_BOTH, it will be an array of <DataValue, RID> pairs
|
||||
* @param outSize The size of the output buffer in bytes.
|
||||
* @param written (out parameter) A pointer to 1 int, which will contain the
|
||||
* number of bytes written to out.
|
||||
* @note See PrimitiveMsg.h for the type definitions.
|
||||
*/
|
||||
void p_Col(NewColRequestHeader* in, NewColResultHeader* out, unsigned outSize,
|
||||
unsigned* written);
|
||||
|
||||
boost::shared_ptr<ParsedColumnFilter> parseColumnFilter(const uint8_t *filterString,
|
||||
uint32_t colWidth, uint32_t colType, uint32_t filterCount, uint32_t BOP);
|
||||
void setParsedColumnFilter(boost::shared_ptr<ParsedColumnFilter>);
|
||||
boost::shared_ptr<ParsedColumnFilter> parseColumnFilter(const uint8_t* filterString,
|
||||
uint32_t colWidth, uint32_t colType, uint32_t filterCount, uint32_t BOP);
|
||||
void setParsedColumnFilter(boost::shared_ptr<ParsedColumnFilter>);
|
||||
|
||||
/** @brief The p_ColAggregate primitive processor.
|
||||
*
|
||||
* The p_ColAggregate primitive processor. It operates on a column block
|
||||
* specified using setBlockPtr().
|
||||
* @param in The buffer containing the command parameters. The buffer should begin
|
||||
* with a NewColAggRequestHeader, followed by an array of RIDs to generate
|
||||
* the data for (optional).
|
||||
* @param out The buffer to put the result in. On return, it will contain a
|
||||
* NewCollAggResultHeader.
|
||||
* @note See PrimitiveMsg.h for the type definitions.
|
||||
*/
|
||||
/** @brief The p_ColAggregate primitive processor.
|
||||
*
|
||||
* The p_ColAggregate primitive processor. It operates on a column block
|
||||
* specified using setBlockPtr().
|
||||
* @param in The buffer containing the command parameters. The buffer should begin
|
||||
* with a NewColAggRequestHeader, followed by an array of RIDs to generate
|
||||
* the data for (optional).
|
||||
* @param out The buffer to put the result in. On return, it will contain a
|
||||
* NewCollAggResultHeader.
|
||||
* @note See PrimitiveMsg.h for the type definitions.
|
||||
*/
|
||||
// void p_ColAggregate(const NewColAggRequestHeader *in, NewColAggResultHeader *out);
|
||||
|
||||
void p_Dictionary(const DictInput *in, std::vector<uint8_t> *out, bool utf8,
|
||||
bool skipNulls, boost::shared_ptr<DictEqualityFilter> eqFilter,
|
||||
uint8_t eqOp);
|
||||
void p_Dictionary(const DictInput* in, std::vector<uint8_t>* out, bool utf8,
|
||||
bool skipNulls, boost::shared_ptr<DictEqualityFilter> eqFilter,
|
||||
uint8_t eqOp);
|
||||
|
||||
inline void setLogicalBlockMode(bool b) { logicalBlockMode = b; }
|
||||
inline void setLogicalBlockMode(bool b)
|
||||
{
|
||||
logicalBlockMode = b;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int convertToRegexp(idb_regex_t *regex, const p_DataValue *str);
|
||||
inline static bool isEscapedChar(char c);
|
||||
boost::shared_array<idb_regex_t> makeLikeFilter(const DictFilterElement *inputMsg, uint32_t count);
|
||||
void setLikeFilter(boost::shared_array<idb_regex_t> filter) { parsedLikeFilter = filter; }
|
||||
static int convertToRegexp(idb_regex_t* regex, const p_DataValue* str);
|
||||
inline static bool isEscapedChar(char c);
|
||||
boost::shared_array<idb_regex_t> makeLikeFilter(const DictFilterElement* inputMsg, uint32_t count);
|
||||
void setLikeFilter(boost::shared_array<idb_regex_t> filter)
|
||||
{
|
||||
parsedLikeFilter = filter;
|
||||
}
|
||||
|
||||
private:
|
||||
PrimitiveProcessor(const PrimitiveProcessor& rhs);
|
||||
PrimitiveProcessor& operator=(const PrimitiveProcessor& rhs);
|
||||
PrimitiveProcessor(const PrimitiveProcessor& rhs);
|
||||
PrimitiveProcessor& operator=(const PrimitiveProcessor& rhs);
|
||||
|
||||
int *block;
|
||||
int* block;
|
||||
|
||||
bool compare(int cmpResult, uint8_t COP, int len1, int len2) throw();
|
||||
int compare(int val1, int val2, uint8_t COP, bool lastStage) throw();
|
||||
void indexWalk_1(const IndexWalkHeader *in, std::vector<IndexWalkHeader *> *out) throw();
|
||||
void indexWalk_2(const IndexWalkHeader *in, std::vector<IndexWalkHeader *> *out) throw();
|
||||
void indexWalk_many(const IndexWalkHeader *in, std::vector<IndexWalkHeader *> *out) throw();
|
||||
void grabSubTree(const IndexWalkHeader *in, std::vector<IndexWalkHeader *> *out) throw();
|
||||
bool compare(int cmpResult, uint8_t COP, int len1, int len2) throw();
|
||||
int compare(int val1, int val2, uint8_t COP, bool lastStage) throw();
|
||||
void indexWalk_1(const IndexWalkHeader* in, std::vector<IndexWalkHeader*>* out) throw();
|
||||
void indexWalk_2(const IndexWalkHeader* in, std::vector<IndexWalkHeader*>* out) throw();
|
||||
void indexWalk_many(const IndexWalkHeader* in, std::vector<IndexWalkHeader*>* out) throw();
|
||||
void grabSubTree(const IndexWalkHeader* in, std::vector<IndexWalkHeader*>* out) throw();
|
||||
|
||||
void nextSig(int NVALS, const PrimToken *tokens, p_DataValue *ret,
|
||||
uint8_t outputFlags = 0, bool oldGetSigBehavior = false, bool skipNulls = false) throw();
|
||||
bool isLike(const p_DataValue *dict, const idb_regex_t *arg) throw();
|
||||
void nextSig(int NVALS, const PrimToken* tokens, p_DataValue* ret,
|
||||
uint8_t outputFlags = 0, bool oldGetSigBehavior = false, bool skipNulls = false) throw();
|
||||
bool isLike(const p_DataValue* dict, const idb_regex_t* arg) throw();
|
||||
|
||||
// void do_sum8(NewColAggResultHeader *out, int64_t val);
|
||||
// void do_unsignedsum8(NewColAggResultHeader *out, int64_t val);
|
||||
|
||||
uint64_t masks[11];
|
||||
int dict_OffsetIndex, currentOffsetIndex; // used by p_dictionary
|
||||
int fDebugLevel;
|
||||
dbbc::Stats* fStatsPtr; // pointer for pmstats
|
||||
bool logicalBlockMode;
|
||||
uint64_t masks[11];
|
||||
int dict_OffsetIndex, currentOffsetIndex; // used by p_dictionary
|
||||
int fDebugLevel;
|
||||
dbbc::Stats* fStatsPtr; // pointer for pmstats
|
||||
bool logicalBlockMode;
|
||||
|
||||
boost::shared_ptr<ParsedColumnFilter> parsedColumnFilter;
|
||||
boost::shared_array<idb_regex_t> parsedLikeFilter;
|
||||
boost::shared_ptr<ParsedColumnFilter> parsedColumnFilter;
|
||||
boost::shared_array<idb_regex_t> parsedLikeFilter;
|
||||
|
||||
friend class ::PrimTest;
|
||||
friend class ::PrimTest;
|
||||
};
|
||||
|
||||
} //namespace primitives
|
||||
|
@ -36,69 +36,77 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
void usage(char *name)
|
||||
void usage(char* name)
|
||||
{
|
||||
cerr << "Usage: " << name << " dict_block_filename" << endl;
|
||||
exit(0);
|
||||
cerr << "Usage: " << name << " dict_block_filename" << endl;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void parseDictBlock(char *block)
|
||||
void parseDictBlock(char* block)
|
||||
{
|
||||
|
||||
uint16_t *offsets;
|
||||
uint16_t *freeBytes;
|
||||
u_int64_t *contPtr;
|
||||
int offsetIndex, size;
|
||||
char sig[BLOCK_SIZE+1];
|
||||
uint16_t* offsets;
|
||||
uint16_t* freeBytes;
|
||||
u_int64_t* contPtr;
|
||||
int offsetIndex, size;
|
||||
char sig[BLOCK_SIZE + 1];
|
||||
|
||||
freeBytes = reinterpret_cast<uint16_t *>(&block[0]);
|
||||
contPtr = reinterpret_cast<u_int64_t *>(&block[2]);
|
||||
offsets = reinterpret_cast<uint16_t *>(&block[10]);
|
||||
freeBytes = reinterpret_cast<uint16_t*>(&block[0]);
|
||||
contPtr = reinterpret_cast<u_int64_t*>(&block[2]);
|
||||
offsets = reinterpret_cast<uint16_t*>(&block[10]);
|
||||
|
||||
cout << "Free Bytes: " << *freeBytes << endl;
|
||||
cout << "Continuation Pointer: 0x" << hex << *contPtr << dec << endl;
|
||||
|
||||
for (offsetIndex = 0; offsets[offsetIndex+1] != 0xffff; offsetIndex++) {
|
||||
size = offsets[offsetIndex] - offsets[offsetIndex+1];
|
||||
memcpy(sig, &block[offsets[offsetIndex+1]], size);
|
||||
sig[size] = '\0';
|
||||
cout << "Offset #" << offsetIndex + 1 << ": size=" << size << " offset="
|
||||
<< offsets[offsetIndex+1] << endl;
|
||||
cout << "Free Bytes: " << *freeBytes << endl;
|
||||
cout << "Continuation Pointer: 0x" << hex << *contPtr << dec << endl;
|
||||
|
||||
for (offsetIndex = 0; offsets[offsetIndex + 1] != 0xffff; offsetIndex++)
|
||||
{
|
||||
size = offsets[offsetIndex] - offsets[offsetIndex + 1];
|
||||
memcpy(sig, &block[offsets[offsetIndex + 1]], size);
|
||||
sig[size] = '\0';
|
||||
cout << "Offset #" << offsetIndex + 1 << ": size=" << size << " offset="
|
||||
<< offsets[offsetIndex + 1] << endl;
|
||||
|
||||
// Use these lines instead for non-ascii data.
|
||||
// cout << " Signature: 0x";
|
||||
// for (i = 0; i < size; i++)
|
||||
// cout << hex << (((int) sig[i]) & 0xff);
|
||||
cout << " Signature: " << sig;
|
||||
cout << dec << endl;
|
||||
}
|
||||
cout << " Signature: " << sig;
|
||||
cout << dec << endl;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int fd, err;
|
||||
char buf[BLOCK_SIZE];
|
||||
int fd, err;
|
||||
char buf[BLOCK_SIZE];
|
||||
|
||||
if (argc != 2)
|
||||
usage(argv[0]);
|
||||
if (argc != 2)
|
||||
usage(argv[0]);
|
||||
|
||||
fd = open(argv[1], O_RDONLY);
|
||||
if (fd < 0) {
|
||||
perror("open");
|
||||
exit(1);
|
||||
}
|
||||
err = read(fd, buf, BLOCK_SIZE);
|
||||
if (err < 0) {
|
||||
perror("read");
|
||||
exit(1);
|
||||
}
|
||||
if (err != BLOCK_SIZE) {
|
||||
cerr << "Failed to read the file in one op, check the filelength and try again."
|
||||
<< endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
parseDictBlock(buf);
|
||||
exit(0);
|
||||
fd = open(argv[1], O_RDONLY);
|
||||
|
||||
if (fd < 0)
|
||||
{
|
||||
perror("open");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
err = read(fd, buf, BLOCK_SIZE);
|
||||
|
||||
if (err < 0)
|
||||
{
|
||||
perror("read");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (err != BLOCK_SIZE)
|
||||
{
|
||||
cerr << "Failed to read the file in one op, check the filelength and try again."
|
||||
<< endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
parseDictBlock(buf);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -41,109 +41,134 @@ using namespace std;
|
||||
|
||||
void usage()
|
||||
{
|
||||
cout << "Usage: print_indexlist filename <S> block_offset subblock sbentry" << endl;
|
||||
cout << " Where S=0 means print the whole block, S=1 means print the subblock" << endl;
|
||||
cout << " Where subblock_number indicates which subblock to print." << endl;
|
||||
cout << " Where sbentry indicates the first entry to print" << endl;
|
||||
exit(1);
|
||||
cout << "Usage: print_indexlist filename <S> block_offset subblock sbentry" << endl;
|
||||
cout << " Where S=0 means print the whole block, S=1 means print the subblock" << endl;
|
||||
cout << " Where subblock_number indicates which subblock to print." << endl;
|
||||
cout << " Where sbentry indicates the first entry to print" << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
char buf[8192];
|
||||
int s, fd, subblock, byteoffset, i, entries, sbentry;
|
||||
string filename;
|
||||
off_t offset;
|
||||
off_t err;
|
||||
IndexListEntry *entry;
|
||||
IndexListParam *ptr;
|
||||
uint32_t fbo;
|
||||
char buf[8192];
|
||||
int s, fd, subblock, byteoffset, i, entries, sbentry;
|
||||
string filename;
|
||||
off_t offset;
|
||||
off_t err;
|
||||
IndexListEntry* entry;
|
||||
IndexListParam* ptr;
|
||||
uint32_t fbo;
|
||||
|
||||
if (argc == 1)
|
||||
usage();
|
||||
|
||||
filename = argv[1];
|
||||
s = atoi(argv[2]);
|
||||
fbo = strtoul(argv[3], 0, 0);
|
||||
subblock = atoi(argv[4]);
|
||||
sbentry = atoi(argv[5]);
|
||||
if (argc == 1)
|
||||
usage();
|
||||
|
||||
fd = open(filename.c_str(), O_RDONLY);
|
||||
if (fd < 0) {
|
||||
perror("open");
|
||||
exit(1);
|
||||
}
|
||||
offset = ((off_t)fbo * BLOCK_SIZE);
|
||||
filename = argv[1];
|
||||
s = atoi(argv[2]);
|
||||
fbo = strtoul(argv[3], 0, 0);
|
||||
subblock = atoi(argv[4]);
|
||||
sbentry = atoi(argv[5]);
|
||||
|
||||
fd = open(filename.c_str(), O_RDONLY);
|
||||
|
||||
if (fd < 0)
|
||||
{
|
||||
perror("open");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
offset = ((off_t)fbo * BLOCK_SIZE);
|
||||
// cout << "BLOCK_SIZE = " << BLOCK_SIZE << " fbo=" << fbo << ", seeking to offset " << offset << endl;
|
||||
err = lseek(fd, offset, SEEK_SET);
|
||||
if (err < 0) {
|
||||
perror("lseek");
|
||||
exit(1);
|
||||
}
|
||||
err = read(fd, buf, BLOCK_SIZE);
|
||||
if (err != BLOCK_SIZE) {
|
||||
if (err < 0)
|
||||
perror("read");
|
||||
cerr << "read error." << endl;
|
||||
exit(1);
|
||||
}
|
||||
close(fd);
|
||||
|
||||
byteoffset = subblock * 256;
|
||||
err = lseek(fd, offset, SEEK_SET);
|
||||
|
||||
if (err < 0)
|
||||
{
|
||||
perror("lseek");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
err = read(fd, buf, BLOCK_SIZE);
|
||||
|
||||
if (err != BLOCK_SIZE)
|
||||
{
|
||||
if (err < 0)
|
||||
perror("read");
|
||||
|
||||
cerr << "read error." << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
close(fd);
|
||||
|
||||
byteoffset = subblock * 256;
|
||||
// cout << "subblock=" << subblock << " byte offset=" << byteoffset << endl;
|
||||
entry = reinterpret_cast<IndexListEntry *>(&buf[byteoffset]);
|
||||
if (s == 0 && subblock == 0)
|
||||
entries = 1024;
|
||||
else
|
||||
entries = 32;
|
||||
|
||||
for (i = sbentry; i < entries; i++) {
|
||||
|
||||
cout << i << ": ";
|
||||
switch (entry[i].type) {
|
||||
case LLP_SUBBLK:
|
||||
ptr = reinterpret_cast<IndexListParam *>(&entry[i]);
|
||||
cout << "Subblock pointer. Rid count=" << entry[i].ridCt <<
|
||||
" LBID=" << ptr->fbo << " subblock=" << ptr->sbid <<
|
||||
" SBentry=" << ptr->entry << endl;
|
||||
break;
|
||||
case LLP_BLK:
|
||||
ptr = reinterpret_cast<IndexListParam *>(&entry[i]);
|
||||
cout << "Block pointer. Rid count=" << entry[i].ridCt <<
|
||||
" LBID=" << ptr->fbo << " subblock=" <<
|
||||
ptr->sbid << " SBentry=" << ptr->entry << endl;
|
||||
break;
|
||||
case RID:
|
||||
cout << "RID: " << entry[i].value << endl;
|
||||
break;
|
||||
case LIST_SIZE:
|
||||
if (i == sbentry) {
|
||||
u_int64_t *val = reinterpret_cast<u_int64_t *>(&entry[i+1]);
|
||||
cout << "List Header. Rid count=" << entry[i].value;
|
||||
cout << " key value=0x" << hex << *val << dec << endl;
|
||||
i++;
|
||||
}
|
||||
else if (i + 1 < entries) {
|
||||
u_int64_t *val = reinterpret_cast<u_int64_t *>(&entry[i+1]);
|
||||
cout << "List Size entry. Rid count=" << entry[i].value
|
||||
<< " (if a header) value=0x" << hex << *val << dec << endl;
|
||||
}
|
||||
else
|
||||
cout << "List Size entry. Rid count=" << entry[i].value << endl;
|
||||
break;
|
||||
case NOT_IN_USE:
|
||||
cout << "Not in use (ignored by p_idxlist)" << endl;
|
||||
break;
|
||||
case EMPTY_LIST_PTR:
|
||||
cout << "Empty List Pointer (?) (ignored by p_idxlist)" << endl;
|
||||
break;
|
||||
case EMPTY_PTR:
|
||||
cout << "Empty Pointer entry (?) (ignored by p_idxlist)" << endl;
|
||||
break;
|
||||
default:
|
||||
cout << "Unknown entry type (" << entry[i].type << ")" << endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
entry = reinterpret_cast<IndexListEntry*>(&buf[byteoffset]);
|
||||
|
||||
if (s == 0 && subblock == 0)
|
||||
entries = 1024;
|
||||
else
|
||||
entries = 32;
|
||||
|
||||
for (i = sbentry; i < entries; i++)
|
||||
{
|
||||
|
||||
cout << i << ": ";
|
||||
|
||||
switch (entry[i].type)
|
||||
{
|
||||
case LLP_SUBBLK:
|
||||
ptr = reinterpret_cast<IndexListParam*>(&entry[i]);
|
||||
cout << "Subblock pointer. Rid count=" << entry[i].ridCt <<
|
||||
" LBID=" << ptr->fbo << " subblock=" << ptr->sbid <<
|
||||
" SBentry=" << ptr->entry << endl;
|
||||
break;
|
||||
|
||||
case LLP_BLK:
|
||||
ptr = reinterpret_cast<IndexListParam*>(&entry[i]);
|
||||
cout << "Block pointer. Rid count=" << entry[i].ridCt <<
|
||||
" LBID=" << ptr->fbo << " subblock=" <<
|
||||
ptr->sbid << " SBentry=" << ptr->entry << endl;
|
||||
break;
|
||||
|
||||
case RID:
|
||||
cout << "RID: " << entry[i].value << endl;
|
||||
break;
|
||||
|
||||
case LIST_SIZE:
|
||||
if (i == sbentry)
|
||||
{
|
||||
u_int64_t* val = reinterpret_cast<u_int64_t*>(&entry[i + 1]);
|
||||
cout << "List Header. Rid count=" << entry[i].value;
|
||||
cout << " key value=0x" << hex << *val << dec << endl;
|
||||
i++;
|
||||
}
|
||||
else if (i + 1 < entries)
|
||||
{
|
||||
u_int64_t* val = reinterpret_cast<u_int64_t*>(&entry[i + 1]);
|
||||
cout << "List Size entry. Rid count=" << entry[i].value
|
||||
<< " (if a header) value=0x" << hex << *val << dec << endl;
|
||||
}
|
||||
else
|
||||
cout << "List Size entry. Rid count=" << entry[i].value << endl;
|
||||
|
||||
break;
|
||||
|
||||
case NOT_IN_USE:
|
||||
cout << "Not in use (ignored by p_idxlist)" << endl;
|
||||
break;
|
||||
|
||||
case EMPTY_LIST_PTR:
|
||||
cout << "Empty List Pointer (?) (ignored by p_idxlist)" << endl;
|
||||
break;
|
||||
|
||||
case EMPTY_PTR:
|
||||
cout << "Empty Pointer entry (?) (ignored by p_idxlist)" << endl;
|
||||
break;
|
||||
|
||||
default:
|
||||
cout << "Unknown entry type (" << entry[i].type << ")" << endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -38,48 +38,54 @@ using namespace std;
|
||||
|
||||
void usage()
|
||||
{
|
||||
cout << "Usage: print_indextree_subblock filename block_offset subblock_number" << endl;
|
||||
exit(1);
|
||||
cout << "Usage: print_indextree_subblock filename block_offset subblock_number" << endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
char buf[256];
|
||||
int fd, err, subblock, fbo, byteoffset, i;
|
||||
string filename;
|
||||
WriteEngine::IdxBitTestEntry *entry;
|
||||
char buf[256];
|
||||
int fd, err, subblock, fbo, byteoffset, i;
|
||||
string filename;
|
||||
WriteEngine::IdxBitTestEntry* entry;
|
||||
|
||||
if (argc != 4)
|
||||
usage();
|
||||
|
||||
filename = argv[1];
|
||||
fbo = atoi(argv[2]);
|
||||
subblock = atoi(argv[3]);
|
||||
if (argc != 4)
|
||||
usage();
|
||||
|
||||
cout << "FBO: " << fbo << " Subblock: " << subblock << endl;
|
||||
fd = open(filename.c_str(), O_RDONLY);
|
||||
if (fd < 0) {
|
||||
perror("open");
|
||||
exit(1);
|
||||
}
|
||||
filename = argv[1];
|
||||
fbo = atoi(argv[2]);
|
||||
subblock = atoi(argv[3]);
|
||||
|
||||
byteoffset = fbo * BLOCK_SIZE + subblock * 256;
|
||||
lseek(fd, byteoffset, SEEK_SET);
|
||||
err = read(fd, buf, 256);
|
||||
if (err != 256) {
|
||||
perror("read");
|
||||
exit(1);
|
||||
}
|
||||
close(fd);
|
||||
cout << "FBO: " << fbo << " Subblock: " << subblock << endl;
|
||||
fd = open(filename.c_str(), O_RDONLY);
|
||||
|
||||
for (i = 0, byteoffset = 0; byteoffset < 256;
|
||||
byteoffset += sizeof(WriteEngine::IdxBitTestEntry), i++) {
|
||||
entry = (WriteEngine::IdxBitTestEntry *) &buf[byteoffset];
|
||||
cout << "Entry " << i << ": fbo=" << (int)entry->fbo <<
|
||||
" sbid=" << entry->sbid << " sbentry=" << entry->entry <<
|
||||
" group=" << entry->group << " bittest=" << entry->bitTest <<
|
||||
" type=" << entry->type << endl;
|
||||
}
|
||||
if (fd < 0)
|
||||
{
|
||||
perror("open");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
exit(0);
|
||||
byteoffset = fbo * BLOCK_SIZE + subblock * 256;
|
||||
lseek(fd, byteoffset, SEEK_SET);
|
||||
err = read(fd, buf, 256);
|
||||
|
||||
if (err != 256)
|
||||
{
|
||||
perror("read");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
close(fd);
|
||||
|
||||
for (i = 0, byteoffset = 0; byteoffset < 256;
|
||||
byteoffset += sizeof(WriteEngine::IdxBitTestEntry), i++)
|
||||
{
|
||||
entry = (WriteEngine::IdxBitTestEntry*) &buf[byteoffset];
|
||||
cout << "Entry " << i << ": fbo=" << (int)entry->fbo <<
|
||||
" sbid=" << entry->sbid << " sbentry=" << entry->entry <<
|
||||
" group=" << entry->group << " bittest=" << entry->bitTest <<
|
||||
" type=" << entry->type << endl;
|
||||
}
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user