Skip to content

Commit

Permalink
feat(stonedb): Header file format standardization (#36) (#105)
Browse files Browse the repository at this point in the history
* feat(stonedb): Header file format standardization (#36)
  • Loading branch information
konghaiya authored Jun 27, 2022
1 parent 1ad95c3 commit e20db9f
Show file tree
Hide file tree
Showing 269 changed files with 1,137 additions and 1,136 deletions.
16 changes: 8 additions & 8 deletions sql/sql_parse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3053,11 +3053,11 @@ case SQLCOM_PREPARE:
and item_list belong to SELECT
*/
// StoneDB hook added
int bh_res, free_join_from_bh, optimize_after_bh;
if(stonedb::dbhandler::SDB_HandleSelect(thd, lex, result, 0, bh_res, optimize_after_bh, free_join_from_bh, (int)true) == 0)
res= handle_select(thd, result, 0, optimize_after_bh, free_join_from_bh);
int sdb_res, free_join_from_sdb, optimize_after_sdb;
if(stonedb::dbhandler::SDB_HandleSelect(thd, lex, result, 0, sdb_res, optimize_after_sdb, free_join_from_sdb, (int)true) == 0)
res= handle_select(thd, result, 0, optimize_after_sdb, free_join_from_sdb);
else
res= bh_res;
res= sdb_res;
//res= handle_select(thd, result, 0);
delete result;
}
Expand Down Expand Up @@ -3542,15 +3542,15 @@ case SQLCOM_PREPARE:
// StoneDB tries to handle a query
// if StoneDB leaves the query for MySQL engine
// then the derived tables are filled and the query gets into the original MySQL execution path
int bh_res, free_join_from_bh, optimize_after_bh;
int sdb_res, free_join_from_sdb, optimize_after_sdb;

//FIXME: this doesn't work but just compile
select_result *sel_result2 = sel_result;
if (stonedb::dbhandler::SDB_HandleSelect(thd, lex, sel_result2, (ulong)OPTION_SETUP_TABLES_DONE,
bh_res, optimize_after_bh, free_join_from_bh, (int)true)==0)
res= handle_select(thd, sel_result, OPTION_SETUP_TABLES_DONE, optimize_after_bh, free_join_from_bh);
sdb_res, optimize_after_sdb, free_join_from_sdb, (int)true)==0)
res= handle_select(thd, sel_result, OPTION_SETUP_TABLES_DONE, optimize_after_sdb, free_join_from_sdb);
else
res= bh_res;
res= sdb_res;
// res= handle_select(thd, sel_result, OPTION_SETUP_TABLES_DONE);
/*
Invalidate the table in the query cache if something changed
Expand Down
20 changes: 10 additions & 10 deletions sql/sql_select.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static void push_index_cond(JOIN_TAB *tab, uint keyno, bool other_tbls_ok,

bool handle_select(THD *thd, select_result *result,
ulong setup_tables_done_option,
int optimize_after_bh, int free_join_from_bh)
int optimize_after_sdb, int free_join_from_sdb)
{
bool res;
LEX *lex= thd->lex;
Expand All @@ -92,7 +92,7 @@ bool handle_select(THD *thd, select_result *result,
// res= mysql_union(thd, lex, result, &lex->unit, setup_tables_done_option);
{
res = FALSE;
if (optimize_after_bh)
if (optimize_after_sdb)
res= lex->unit.optimize_after_stonedb(); // optimization after StoneDB
if (!res)
res= mysql_union(thd, lex, result, &lex->unit, setup_tables_done_option);
Expand All @@ -115,7 +115,7 @@ bool handle_select(THD *thd, select_result *result,
select_lex->having,
select_lex->options | thd->variables.option_bits | setup_tables_done_option,
result, unit, select_lex,
optimize_after_bh, free_join_from_bh);
optimize_after_sdb, free_join_from_sdb);
}
DBUG_PRINT("info",("res: %d report_error: %d", res,
thd->is_error()));
Expand Down Expand Up @@ -1083,7 +1083,7 @@ mysql_prepare_select(THD *thd,
*/

static bool
mysql_execute_select(THD *thd, SELECT_LEX *select_lex, bool free_join, int optimize_after_bh)
mysql_execute_select(THD *thd, SELECT_LEX *select_lex, bool free_join, int optimize_after_sdb)
{
bool err;
JOIN* join= select_lex->join;
Expand All @@ -1092,8 +1092,8 @@ mysql_execute_select(THD *thd, SELECT_LEX *select_lex, bool free_join, int optim
DBUG_ASSERT(join);

// optimization after StoneDB
if (optimize_after_bh) {
int part = optimize_after_bh == TRUE ? 2 : 4;
if (optimize_after_sdb) {
int part = optimize_after_sdb == TRUE ? 2 : 4;
err= join->optimize(part);
}
else
Expand Down Expand Up @@ -1172,7 +1172,7 @@ mysql_select(THD *thd,
Item *having, ulonglong select_options,
select_result *result, SELECT_LEX_UNIT *unit,
SELECT_LEX *select_lex,
int optimize_after_bh, int free_join_from_bh) // FIXME:
int optimize_after_sdb, int free_join_from_sdb) // FIXME:
{
bool free_join= true;
uint og_num= 0;
Expand All @@ -1191,8 +1191,8 @@ mysql_select(THD *thd,
first_group= group->first;
}

if (optimize_after_bh)
free_join = free_join_from_bh;
if (optimize_after_sdb)
free_join = free_join_from_sdb;
else { // FIXME:

if (mysql_prepare_select(thd, tables, wild_num, fields,
Expand Down Expand Up @@ -1240,7 +1240,7 @@ mysql_select(THD *thd,
}
}

DBUG_RETURN(mysql_execute_select(thd, select_lex, free_join, optimize_after_bh));
DBUG_RETURN(mysql_execute_select(thd, select_lex, free_join, optimize_after_sdb));
}

/*****************************************************************************
Expand Down
6 changes: 3 additions & 3 deletions sql/sql_select.h
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,7 @@ class store_key_const_item :public store_key_item
bool error_if_full_join(JOIN *join);
bool handle_select(THD *thd, select_result *result,
ulong setup_tables_done_option,
int optimize_after_bh = FALSE, int free_join_from_bh = FALSE);
int optimize_after_sdb = FALSE, int free_join_from_sdb = FALSE);

bool mysql_select(THD *thd,
TABLE_LIST *tables, uint wild_num, List<Item> &list,
Expand All @@ -1320,8 +1320,8 @@ bool mysql_select(THD *thd,
Item *having, ulonglong select_type,
select_result *result, SELECT_LEX_UNIT *unit,
SELECT_LEX *select_lex,
int optimize_after_bh = FALSE, // FIXME
int free_join_from_bh = FALSE);
int optimize_after_sdb = FALSE, // FIXME
int free_join_from_sdb = FALSE);

void free_underlaid_joins(THD *thd, SELECT_LEX *select);

Expand Down
12 changes: 6 additions & 6 deletions storage/stonedb/async_tests/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ copyright info
*/
#include <iostream>

#include "core/app_template.h"
#include "core/distributed.h"
#include "core/reactor.h"
#include "core/sleep.h"
#include "core/thread.h"
#include "base/core/app_template.h"
#include "base/core/distributed.h"
#include "base/core/reactor.h"
#include "base/core/sleep.h"
#include "base/core/thread.h"

#include "task_executor.h"
#include "async_tests/task_executor.h"

using namespace std::chrono_literals;
using namespace stonedb;
Expand Down
4 changes: 2 additions & 2 deletions storage/stonedb/async_tests/task_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

#include <boost/lockfree/queue.hpp>

#include "core/app_template.h"
#include "core/future.h"
#include "base/core/app_template.h"
#include "base/core/future.h"
#include "core/task_executor.h"

#ifndef DISABLE_USED_FOR_STONEDB
Expand Down
2 changes: 1 addition & 1 deletion storage/stonedb/base/core/aligned_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <memory>
#include <stdexcept>

#include "print.h"
#include "base/core/print.h"

namespace stonedb {
namespace base {
Expand Down
12 changes: 6 additions & 6 deletions storage/stonedb/base/core/app_template.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
#include <cstdlib>
#include <fstream>

#include "core/metrics_api.h"
#include "core/print.h"
#include "core/reactor.h"
#include "core/scollectd.h"
#include "util/log.h"
#include "util/log_cli.h"
#include "base/core/metrics_api.h"
#include "base/core/print.h"
#include "base/core/reactor.h"
#include "base/core/scollectd.h"
#include "base/util/log.h"
#include "base/util/log_cli.h"

namespace stonedb {
namespace base {
Expand Down
2 changes: 1 addition & 1 deletion storage/stonedb/base/core/byteorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <algorithm>

#include <endian.h>
#include "unaligned.h"
#include "base/core/unaligned.h"

namespace stonedb {
namespace base {
Expand Down
4 changes: 2 additions & 2 deletions storage/stonedb/base/core/circular_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@

#include <algorithm>
#include <memory>
#include "bitops.h"
#include "transfer.h"
#include "base/core/bitops.h"
#include "base/core/transfer.h"

namespace stonedb {
namespace base {
Expand Down
4 changes: 2 additions & 2 deletions storage/stonedb/base/core/condition_variable.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#define STONEDB_BASE_COND_VAR_H_
#pragma once

#include "core/future_util.h"
#include "core/semaphore.h"
#include "base/core/future_util.h"
#include "base/core/semaphore.h"

namespace stonedb {
namespace base {
Expand Down
2 changes: 1 addition & 1 deletion storage/stonedb/base/core/distributed.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#define STONEDB_BASE_DISTRIBUTED_H_
#pragma once

#include "sharded.h"
#include "base/core/sharded.h"

namespace stonedb {
namespace base {
Expand Down
2 changes: 1 addition & 1 deletion storage/stonedb/base/core/do_with.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <memory>
#include <tuple>
#include <utility>
#include "apply.h"
#include "base/core/apply.h"

namespace stonedb {
namespace base {
Expand Down
20 changes: 10 additions & 10 deletions storage/stonedb/base/core/execution_stage.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
#define STONEDB_BASE_EXECUTION_STAGE_H_
#pragma once

#include "chunked_fifo.h"
#include "function_traits.h"
#include "future.h"
#include "metrics.h"
#include "scheduling.h"
#include "sstring.h"

#include "../util/defer.h"
#include "util/gcc6-concepts.h"
#include "util/reference_wrapper.h"
#include "base/core/chunked_fifo.h"
#include "base/core/function_traits.h"
#include "base/core/future.h"
#include "base/core/metrics.h"
#include "base/core/scheduling.h"
#include "base/core/sstring.h"

#include "base/util/defer.h"
#include "base/util/gcc6-concepts.h"
#include "base/util/reference_wrapper.h"

namespace stonedb {
namespace base {
Expand Down
10 changes: 5 additions & 5 deletions storage/stonedb/base/core/expiring_fifo.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
#include <exception>
#include <stdexcept>

#include "chunked_fifo.h"
#include "future.h"
#include "future_util.h"
#include "lowres_clock.h"
#include "timer.h"
#include "base/core/chunked_fifo.h"
#include "base/core/future.h"
#include "base/core/future_util.h"
#include "base/core/lowres_clock.h"
#include "base/core/timer.h"

namespace stonedb {
namespace base {
Expand Down
10 changes: 5 additions & 5 deletions storage/stonedb/base/core/fair_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
#include <type_traits>
#include <unordered_set>

#include "circular_buffer.h"
#include "future.h"
#include "print.h"
#include "semaphore.h"
#include "shared_ptr.h"
#include "base/core/circular_buffer.h"
#include "base/core/future.h"
#include "base/core/print.h"
#include "base/core/semaphore.h"
#include "base/core/shared_ptr.h"

namespace stonedb {
namespace base {
Expand Down
12 changes: 6 additions & 6 deletions storage/stonedb/base/core/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
#include <experimental/optional>
#include <system_error>

#include "core/align.h"
#include "core/fair_queue.h"
#include "core/future_util.h"
#include "core/shared_ptr.h"
#include "sstring.h"
#include "stream.h"
#include "base/core/align.h"
#include "base/core/fair_queue.h"
#include "base/core/future_util.h"
#include "base/core/shared_ptr.h"
#include "base/core/sstring.h"
#include "base/core/stream.h"

namespace stonedb {
namespace base {
Expand Down
2 changes: 1 addition & 1 deletion storage/stonedb/base/core/file_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <atomic>
#include <deque>

#include "file.h"
#include "base/core/file.h"

namespace stonedb {
namespace base {
Expand Down
4 changes: 2 additions & 2 deletions storage/stonedb/base/core/fsqual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
#include <iostream>
#include <type_traits>

#include "posix.h"
#include "util/defer.h"
#include "base/core/posix.h"
#include "base/util/defer.h"

namespace stonedb {
namespace base {
Expand Down
2 changes: 1 addition & 1 deletion storage/stonedb/base/core/fsqual.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#define STONEDB_BASE_FSQUAL_H_
#pragma once

#include "sstring.h"
#include "base/core/sstring.h"

namespace stonedb {
namespace base {
Expand Down
8 changes: 4 additions & 4 deletions storage/stonedb/base/core/fstream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
#include "fstream.h"
#include <malloc.h>
#include <cstring>
#include "align.h"
#include "circular_buffer.h"
#include "reactor.h"
#include "semaphore.h"
#include "base/core/align.h"
#include "base/core/circular_buffer.h"
#include "base/core/reactor.h"
#include "base/core/semaphore.h"

namespace stonedb::base {
class file_data_source_impl : public data_source_impl {
Expand Down
6 changes: 3 additions & 3 deletions storage/stonedb/base/core/fstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
// interface to files, while retaining the zero-copy characteristics of
// seastar files.

#include "file.h"
#include "iostream.h"
#include "shared_ptr.h"
#include "base/core/file.h"
#include "base/core/iostream.h"
#include "base/core/shared_ptr.h"

namespace stonedb {
namespace base {
Expand Down
12 changes: 6 additions & 6 deletions storage/stonedb/base/core/future.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
#include <stdexcept>
#include <type_traits>

#include "../util/gcc6-concepts.h"
#include "apply.h"
#include "function_traits.h"
#include "preempt.h"
#include "task.h"
#include "thread_impl.h"
#include "base/core/apply.h"
#include "base/core/function_traits.h"
#include "base/core/preempt.h"
#include "base/core/task.h"
#include "base/core/thread_impl.h"
#include "base/util/gcc6-concepts.h"

namespace stonedb {
namespace base {
Expand Down
Loading

0 comments on commit e20db9f

Please sign in to comment.