-
Notifications
You must be signed in to change notification settings - Fork 994
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4703 from sysown/v3.0_refactor_query_cache
Refactored and Optimized Query Cache with PgSQL Support
- Loading branch information
Showing
32 changed files
with
2,433 additions
and
747 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef __CLASS_MYSQL_QUERY_CACHE_H | ||
#define __CLASS_MYSQL_QUERY_CACHE_H | ||
|
||
#include "proxysql.h" | ||
#include "cpp.h" | ||
#include "query_cache.hpp" | ||
|
||
typedef struct _MySQL_QC_entry : public QC_entry_t { | ||
uint32_t column_eof_pkt_offset; | ||
uint32_t row_eof_pkt_offset; | ||
uint32_t ok_pkt_offset; | ||
} MySQL_QC_entry_t; | ||
|
||
class MySQL_Query_Cache : public Query_Cache<MySQL_Query_Cache> { | ||
public: | ||
MySQL_Query_Cache() = default; | ||
~MySQL_Query_Cache() = default; | ||
|
||
bool set(uint64_t user_hash, const unsigned char* kp, uint32_t kl, unsigned char* vp, uint32_t vl, | ||
uint64_t create_ms, uint64_t curtime_ms, uint64_t expire_ms, bool deprecate_eof_active); | ||
unsigned char* get(uint64_t user_hash, const unsigned char* kp, const uint32_t kl, uint32_t* lv, | ||
uint64_t curtime_ms, uint64_t cache_ttl, bool deprecate_eof_active); | ||
//void* purgeHash_thread(void*); | ||
}; | ||
|
||
#endif /* __CLASS_MYSQL_QUERY_CACHE_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef __CLASS_PGSQL_QUERY_CACHE_H | ||
#define __CLASS_PGSQL_QUERY_CACHE_H | ||
|
||
#include "proxysql.h" | ||
#include "cpp.h" | ||
#include "query_cache.hpp" | ||
|
||
typedef struct _PgSQL_QC_entry : public QC_entry_t {} PgSQL_QC_entry_t; | ||
|
||
class PgSQL_Query_Cache : public Query_Cache<PgSQL_Query_Cache> { | ||
public: | ||
PgSQL_Query_Cache() = default; | ||
~PgSQL_Query_Cache() = default; | ||
|
||
bool set(uint64_t user_hash, const unsigned char* kp, uint32_t kl, unsigned char* vp, uint32_t vl, | ||
uint64_t create_ms, uint64_t curtime_ms, uint64_t expire_ms); | ||
const std::shared_ptr<PgSQL_QC_entry_t> get(uint64_t user_hash, const unsigned char* kp, const uint32_t kl, | ||
uint64_t curtime_ms, uint64_t cache_ttl); | ||
//void* purgeHash_thread(void*); | ||
}; | ||
|
||
#endif /* __CLASS_PGSQL_QUERY_CACHE_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.