Commit 3695a861 authored by yiwenshao's avatar yiwenshao

add comments

parent 4ac47930
BasicCrypto.cc
paillier.cc
urandom.cc
arc4.cc
hgd.cc
pbkdf2.cc
ecjoin.cc
ECJoin.cc
search.cc
skip32.cc
ffx.cc
online_ope.cc
mont.cc
prng.cc
ope.cc
SWPSearch.cc
......@@ -373,8 +373,7 @@ SQLDispatcher *buildDDLDispatcher()
std::pair<AbstractQueryExecutor::ResultType, AbstractAnything *>
DDLQueryExecutor::
nextImpl(const ResType &res, const NextParams &nparams)
{
nextImpl(const ResType &res, const NextParams &nparams) {
reenter(this->corot) {
yield {
{
......@@ -393,7 +392,6 @@ nextImpl(const ResType &res, const NextParams &nparams)
TEST_ErrPkt(res.success(), "DDL query failed");
// save the results so we can return them to the client
this->ddl_res = res;
yield {
return CR_QUERY_AGAIN(
" INSERT INTO " + MetaData::Table::remoteQueryCompletion() +
......@@ -402,20 +400,17 @@ nextImpl(const ResType &res, const NextParams &nparams)
" '"+TypeText<CompletionType>::toText(CompletionType::Onion)+"'"
" );");
}
TEST_ErrPkt(res.success(), "failed issuing ddl completion");
// execute the original query against the embedded database
// > this is a ddl query so do not put it into a transaction
TEST_ErrPkt(nparams.ps.getEConn()->execute(nparams.original_query),
"Failed to execute DDL query against embedded database!");
TEST_ErrPkt(deltaOutputAfterQuery(nparams.ps.getEConn(), this->deltas,
this->embedded_completion_id.get()),
"deltaOuputAfterQuery failed for DDL");
yield return CR_RESULTS(this->ddl_res.get());
}
assert(false);
}
......@@ -9,12 +9,8 @@
#include <sql_lex.h>
class DDLQueryExecutor : public AbstractQueryExecutor {
AssignOnce<ResType> ddl_res;
AssignOnce<uint64_t> embedded_completion_id;
public:
const std::string new_query;
DDLQueryExecutor(const LEX &new_lex,
......@@ -23,7 +19,6 @@ public:
~DDLQueryExecutor() {}
std::pair<ResultType, AbstractAnything *>
nextImpl(const ResType &res, const NextParams &nparams);
private:
const std::vector<std::unique_ptr<Delta> > deltas;
bool stales() const {return true;}
......@@ -35,7 +30,6 @@ class DDLHandler : public SQLHandler {
public:
virtual AbstractQueryExecutor *transformLex(Analysis &analysis, LEX *lex)
const;
private:
virtual AbstractQueryExecutor *
rewriteAndUpdate(Analysis &a, LEX *lex, const Preamble &pre) const = 0;
......@@ -44,7 +38,6 @@ protected:
virtual ~DDLHandler() {;}
};
class CreateTableHandler : public DDLHandler {
//must rewrite the header here or we get pure virtual function
virtual AbstractQueryExecutor *
......@@ -52,7 +45,4 @@ class CreateTableHandler : public DDLHandler {
};
SQLDispatcher *buildDDLDispatcher();
......@@ -27,14 +27,12 @@ class SpecialUpdateExecutor : public AbstractQueryExecutor {
const std::string plain_table;
const std::string crypted_table;
const std::string where_clause;
// coroutine state
AssignOnce<ResType> dec_res;
AssignOnce<DBResult *> original_query_dbres;
AssignOnce<std::string> escaped_output_values;
AssignOnce<ReturnMeta> select_rmeta;
AssignOnce<bool> in_trx;
public:
SpecialUpdateExecutor(const std::string &plain_table,
const std::string &crypted_table,
......@@ -154,7 +152,3 @@ rewrite_field_value_pairs(List_iterator<Item> fd_it,
List_iterator<Item> val_it, Analysis &a,
List<Item> *const res_fields,
List<Item> *const res_values);
......@@ -19,9 +19,7 @@ genericPreamble(const NextParams &nparams)
// We handle before any queries because a failed query
// may stale the database during recovery and then
// we'd have to handle there as well.
//首先根据stales来设置这个executor会不会让当前在shared中的cache变成stale,对于simple来说, 继承的是默认的情况, 所以
//不会设置cache为stale, 也就是下次进入rewrite的时候, 不需要重新load.
//stales, if set true, will set the cache status to stale, which triggers the reloading of metadata. The default value of stale, which is from AbstractQueryExecutor, is false.
try {
nparams.ps.getSchemaCache().updateStaleness(
nparams.ps.getEConn(), this->stales());
......
#pragma once
#include <main/Analysis.hh>
#include <util/yield.hpp>
#include <sql_lex.h>
#include <map>
#define CR_QUERY_AGAIN(query) \
......@@ -25,7 +22,6 @@ class Anything;
class AbstractAnything {
public:
virtual ~AbstractAnything() = 0;
template <typename Type>
Type
extract() const
......@@ -62,22 +58,18 @@ struct NextParams {
class AbstractQueryExecutor {
protected:
coroutine corot;
public:
enum class ResultType {RESULTS, QUERY_COME_AGAIN, QUERY_USE_RESULTS};
AbstractQueryExecutor() {}
virtual ~AbstractQueryExecutor();
std::pair<ResultType, AbstractAnything *>
next(const ResType &res, const NextParams &nparams);
virtual std::pair<ResultType, AbstractAnything *>
nextImpl(const ResType &res, const NextParams &nparams) = 0;
//true will set the staleness of the current cache id to true, which results in a reloading of schemaInfo
virtual bool stales() const {return false;}
//if usesEmbedded is true, then the current db of the embedded MySQL is set to embedded_db
virtual bool usesEmbedded() const {return false;}
private:
void genericPreamble(const NextParams &nparams);
};
......@@ -95,7 +87,6 @@ class NoOpExecutor : public AbstractQueryExecutor {
public:
NoOpExecutor() {}
~NoOpExecutor() {}
std::pair<ResultType, AbstractAnything *>
nextImpl(const ResType &res, const NextParams &nparams);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment