主頁 > 資料庫 > 查看、校驗、歸檔…帶你掌握openGauss賬本資料庫

查看、校驗、歸檔…帶你掌握openGauss賬本資料庫

2022-11-17 07:13:17 資料庫

?摘要:賬本資料庫融合了區塊鏈思想,將用戶操作記錄至兩種歷史表中:用戶歷史表和全域區塊表,

本文分享自華為云社區《openGauss賬本資料庫,你不知道的那些事兒》,作者:Gauss松鼠會,

賬本資料庫融合了區塊鏈思想,將用戶操作記錄至兩種歷史表中:用戶歷史表和全域區塊表,當用戶創建防篡改用戶表時,系統將自動為該表添加一個hash列來保存每行資料的hash摘要資訊,同時在blockchain模式下會創建一張用戶歷史表來記錄對應用戶表中每條資料的變更行為;而用戶對防篡改用戶表的一次修改行為將記錄至全域區塊表中,由于歷史表具有只可追加不可修改的特點,因此歷史表記錄串聯起來便形成了用戶對防篡改用戶表的修改歷史,

操作步驟

1.創建防篡改模式,

openGauss=# CREATE SCHEMA ledgernsp WITH BLOCKCHAIN;

首先在這個SQL中我們可以看到WITH BLOCKCHAIN ,這里說明創建出來的SCHEMA與普通的SCHEMA不同,但就行不同在哪里我們后面會提到,

  • 從語法決議看,增加了對BLOCKCHAIN的處理,標記了是否為賬本模式,
 CreateSchema ::= CREATE SCHEMA schema_name
     [ AUTHORIZATION user_name ] [WITH BLOCKCHAIN] [ schema_element [ ... ] ];

  • CreateSchemaStmt 結構中增加了bool型別欄位hasBlockChain
typedef struct CreateSchemaStmt {
   NodeTag type;
 char *schemaname;  /* the name of the schema to create */
 char *authid;      /* the owner of the created schema */
 bool hasBlockChain;  /* whether this schema has blockchain */
   List *schemaElts;  /* schema components (list of parsenodes) */
   TempType temptype; /* if the schema is temp table's schema */
   List *uuids;       /* the list of uuid(only create sequence or table with serial type need) */
} CreateSchemaStmt;

你不知道的限制

賬本資料庫對于ALTER SCHEMA的幾個限制

1)dbe_perf和snapshot兩個模式不能ALTER為blockchain模式,

 if (withBlockchain && ((strncmp(nspName, "dbe_perf", STR_SCHEMA_NAME_LENGTH) == 0) ||
       (strncmp(nspName, "snapshot", STR_SNAPSHOT_LENGTH) == 0))) {
       ereport(ERROR, (errcode(ERRCODE_OPERATE_FAILED),
                       errmsg("The schema '%s' doesn't allow to alter to blockchain schema", nspName)));
   }

2)系統模式不能 ALTER 為blockchain模式,

 if (withBlockchain && !g_instance.attr.attr_common.allowSystemTableMods &&
       !u_sess->attr.attr_common.IsInplaceUpgrade && IsReservedName(nspName))
       ereport(ERROR,
           (errcode(ERRCODE_RESERVED_NAME),
               errmsg("The system schema \"%s\" doesn't allow to alter to blockchain schema", nspName)));

3)包含了表的SCHEMA不能ALTER為blockchain模式,

 /*
    * If the any table exists in the schema, do not change to ledger schema.
    */
   StringInfo existTbl = TableExistInSchema(HeapTupleGetOid(tup), TABLE_TYPE_ANY);
 if (existTbl->len != 0) {
 if (withBlockchain) {
           ereport(ERROR,
               (errcode(ERRCODE_RESERVED_NAME),
                   errmsg("It is not supported to change \"%s\" to blockchain schema which includes tables.",
                       nspName)));
       } else {
           ereport(ERROR,
               (errcode(ERRCODE_RESERVED_NAME),
                   errmsg("It is not supported to change \"%s\" to normal schema which includes tables.",
                       nspName)));
       }
   }

查看模式

2.在防篡改模式下創建防篡改用戶表,

openGauss=# CREATE TABLE ledgernsp.usertable(id int, name text);

你不知道的限制

  • 創建賬本表的同時會自動創建一個“歷史表”和“歷史表的索引”,

在建表時CreateCommand會呼叫AlterCreateChainTables,如果是賬本表再去呼叫create_hist_relation來創建歷史表

CreateCommand -> AlterCreateChainTables -> create_hist_relation

/*
* AlterCreateChainTables
*    If it is a ledger usertable, that should invoking this function.
*    then create a history table.
*/
void AlterCreateChainTables(Oid relOid, Datum reloptions, CreateStmt *mainTblStmt)
{
   Relation rel = NULL;
   rel = heap_open(relOid, AccessExclusiveLock);
 /* Ledger user table only support for the regular relation. */
 if (!rel->rd_isblockchain) {
       heap_close(rel, NoLock);
 return;
   }
   create_hist_relation(rel, reloptions, mainTblStmt);
   heap_close(rel, NoLock);
}
  • 歷史表命名規則,參見函式get_hist_name
bool get_hist_name(Oid relid, const char *rel_name, char *hist_name, Oid nsp_oid, const char *nsp_name)
{
   errno_t rc;
 if (!OidIsValid(relid) || rel_name == NULL) {
 return false;
   }
   nsp_oid = OidIsValid(nsp_oid) ? nsp_oid : get_rel_namespace(relid);
   nsp_name = (nsp_name == NULL) ? get_namespace_name(nsp_oid) : nsp_name;
 int part_hist_name_len = strlen(rel_name) + strlen(nsp_name) + 1;
 if (part_hist_name_len + strlen("_hist") >= NAMEDATALEN) {
       rc = snprintf_s(hist_name, NAMEDATALEN, NAMEDATALEN - 1, "%d_%d_hist", nsp_oid, relid);
       securec_check_ss(rc, "", "");
   } else {
       rc = snprintf_s(hist_name, NAMEDATALEN, NAMEDATALEN - 1, "%s_%s_hist", nsp_name, rel_name);
       securec_check_ss(rc, "", "");
   }
 return true;
}
  • 表名最大長度 #define NAMEDATALEN 64
  • 如果沒有超過長度限制:schema_table_hist
  • 如果超過長度限制:schema(oid)_talbe(oid)_hist,因為oid是unsigned int 型別最大值為4294967295為10位,所以這種命名規則的最大長度為10+1+10+1+4+\0=27,因此永遠不會超過最大長度64,
omm=# create schema aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa with blockchain;
CREATE SCHEMA
omm=# create table aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(id int);
CREATE TABLE

  • 歷史表索引命名規則,參見函式get_hist_name
 /* now create index for this new history table */
 char hist_index_name[NAMEDATALEN];
   rc = snprintf_s(hist_index_name, NAMEDATALEN, NAMEDATALEN - 1, "gs_hist_%u_index", relid);
  • 命名規則:gs_hist_$(賬本表oid)_index,

3、修改防篡改用戶表資料

對防篡改用戶表執行INSERT/UPDATE/DELETE,

openGauss=# INSERT INTO ledgernsp.usertable VALUES(1, 'alex'), (2, 'bob'), (3, 'peter');
INSERT 0 3
openGauss=# SELECT *, hash FROM ledgernsp.usertable ORDER BY id;
id | name  |       hash
----+-------+------------------
 1 | alex  | 1f2e543c580cb8c5
 2 | bob   | 8fcd74a8a6a4b484
 3 | peter | f51b4b1b12d0354b
(3 rows)
openGauss=# UPDATE ledgernsp.usertable SET name = 'bob2' WHERE id = 2;
UPDATE 1
openGauss=# SELECT *, hash FROM ledgernsp.usertable ORDER BY id;
id | name  |       hash
----+-------+------------------
 1 | alex  | 1f2e543c580cb8c5
 2 | bob2  | 437761affbb7c605
 3 | peter | f51b4b1b12d0354b
(3 rows)
openGauss=# DELETE FROM ledgernsp.usertable WHERE id = 3;
DELETE 1
openGauss=# SELECT *, hash FROM ledgernsp.usertable ORDER BY id;
id | name |       hash
----+------+------------------
 1 | alex | 1f2e543c580cb8c5
 2 | bob2 | 437761affbb7c605
(2 rows)

查看賬本歷史操作記錄

官方檔案

前提條件

  • 系統中需要有審計管理員或者具有審計管理員權限的角色,
  • 資料庫正常運行,并且對防篡改資料庫執行了一系列增、刪、改等操作,保證在查詢時段內有賬本操作記錄結果產生,

基本操作

1、查詢全域區塊表記錄,

omm=# SELECT * FROM gs_global_chain;
blocknum | dbname | username |           starttime           | relid |  relnsp   |  relname  |     relhash      |            globalhash            |
                 txcommand
----------+--------+----------+-------------------------------+-------+-----------+-----------+------------------+----------------------------------+----------------
--------------------------------------------------------------
       1 | omm    | omm      | 2022-09-17 13:59:37.84824+00  | 16404 | ledgernsp | usertable | a41714001181a294 | 83927d11ba1fd678e8f4b0723a9cd5f2 | INSERT INTO led
gernsp.usertable VALUES(1, 'alex'), (2, 'bob'), (3, 'peter');
       2 | omm    | omm      | 2022-09-17 13:59:51.723068+00 | 16404 | ledgernsp | usertable | b3a9ed0755131181 | b5ee73b6c20c817230182f6373c78e20 | UPDATE ledgerns
p.usertable SET name = 'bob2' WHERE id = 2;
       3 | omm    | omm      | 2022-09-17 13:59:58.159596+00 | 16404 | ledgernsp | usertable | 0ae4b4e4ed2fcab5 | 0cc9938cf7f1ed7f7f1a03c29954380a | DELETE FROM led
gernsp.usertable WHERE id = 3;
(3 rows)
  • 注冊鉤子,在對賬本做修改操作的時候注冊的鉤子函式ledger_ExecutorEnd被回呼,
/*
* ledger_hook_init -- install of gchain block record hook.
*/
void ledger_hook_init(void)
{
   t_thrd.security_ledger_cxt.prev_ExecutorEnd = (void *)ExecutorEnd_hook;
   ExecutorEnd_hook = ledger_ExecutorEnd;
}
  • 生成globalhash規則
全域區塊表記錄主要是生成globalhash.

呼叫程序:

ledger_ExecutorEnd --> ledger_gchain_append --> set_gchain_comb_string

--> get_next_g_blocknum

--> gen_global_hash

  • set_gchain_comb_string,是一組字串拼接成的:rel_name + nsp_name + query_string + rel_hash
  • get_next_g_blocknum,用全域變數g_blocknum保存
  • gen_global_hash,是的set_gchain_comb_string拼出來的串+上一條的hash值拼串然后再去hash——區塊鏈的基本原理
bool gen_global_hash(hash32_t *hash_buffer, const char *info_string, bool exist, const hash32_t *prev_hash)
{
   errno_t rc = EOK;
 int comb_strlen;
 char *comb_string = NULL;
 /*
    * Previous block not exists means current insertion block is genesis,
    * then we use global systable as origin combine string for globalhash
    * generation. If previous block exists, we will use previous global
    * hash as combine string to calculate globalhash.
    */
 if (!exist) {
 /* generate genesis block globalhash */
       comb_strlen = strlen(GCHAIN_NAME) + strlen(info_string) + 1;
       comb_string = (char *)palloc0(comb_strlen);
       rc = snprintf_s(comb_string, comb_strlen, comb_strlen - 1, "%s%s", GCHAIN_NAME, info_string);
       securec_check_ss(rc, "", "");
   } else {
 /* use previous globalhash and current block info to calculate globalhash. */
 char *pre_hash_str = DatumGetCString(DirectFunctionCall1(hash32out, HASH32GetDatum(prev_hash)));
       comb_strlen = strlen(pre_hash_str) + strlen(info_string) + 1;
       comb_string = (char *)palloc0(comb_strlen);
       rc = snprintf_s(comb_string, comb_strlen, comb_strlen - 1, "%s%s", info_string, pre_hash_str);
       securec_check_ss(rc, "", "");
       pfree_ext(pre_hash_str);
   }
 if (!pg_md5_binary(comb_string, comb_strlen - 1, hash_buffer->data)) {
       pfree(comb_string);
       ereport(ERROR, (errcode(ERRCODE_OUT_OF_MEMORY), errmsg("Failed to generate globalhash, out of memory")));
 return false;
   }
   pfree(comb_string);
 return true;
}
  • 在src/gausskernel/runtime/executor/nodeModifyTable.cpp中更新_hist表的hash值,

  • 通過set_user_tuple_hash得到賬本表hash列的值,
/*
* set_user_tuple_hash -- calculate and fill the hash attribute of user table's tuple.
*
* tup: row data of user table
* rel: user table
* hash_exists: whether tuple comes with tuplehash.
*
* Note: if hash_exists is true, we should recompute
* tuple hash and compare with tuplehash of itself.
*/
HeapTuple set_user_tuple_hash(HeapTuple tup, Relation rel, bool hash_exists)
{
   uint64 row_hash = gen_user_tuple_hash(rel, tup);
 int hash_attrno = user_hash_attrno(rel->rd_att);
 if (hash_exists) {
 bool is_null;
       Datum hash = heap_getattr(tup, hash_attrno + 1, rel->rd_att, &is_null);
 if (is_null || row_hash != DatumGetUInt64(hash)) {
           ereport(ERROR, (errcode(ERRCODE_OPERATE_INVALID_PARAM), errmsg("Invalid tuple hash.")));
       }
 return tup;
   }
   Datum *values = NULL;
 bool *nulls = NULL;
 bool *replaces = NULL;
 /* Build modified tuple */
   int2 nattrs = RelationGetNumberOfAttributes(rel);
   values = (Datum*)palloc0(nattrs * sizeof(Datum));
   nulls = (bool*)palloc0(nattrs * sizeof(bool));
   replaces = (bool*)palloc0(nattrs * sizeof(bool));
   values[hash_attrno] = UInt64GetDatum(row_hash);
   replaces[hash_attrno] = true;
   HeapTuple newtup = heap_modify_tuple(tup, RelationGetDescr(rel), values, nulls, replaces);
   pfree_ext(values);
   pfree_ext(nulls);
   pfree_ext(replaces);
 return newtup;
}

校驗賬本資料一致性

官方檔案

資料庫正常運行,并且對防篡改資料庫執行了一系列增、刪、改等操作,保證在查詢時段內有賬本操作記錄結果產生,

基本操作

1、校驗防篡改用戶表ledgernsp.usertable與其對應的歷史表是否一致,

omm=# SELECT pg_catalog.ledger_hist_check('ledgernsp', 'usertable');
ledger_hist_check
-------------------
t
(1 row)
  • 校驗用戶權限 Only super user or audit admin have access right to blockchain nsp
 /* Only super user or audit admin have access right to blockchain nsp */
 if (nsp_oid == PG_BLOCKCHAIN_NAMESPACE) {
 return gs_blockchain_aclmask(roleid, mask);
   }
  • 校驗歷史表hash值

is_hist_hash_identity --> get_usertable_hash_sum

--> get_histtable_hash_sum

/*
* is_hist_hash_identity -- check whether user table hash and history table hash are equal
*
* relid: user table oid
* res_hash: hash sum of history table
*/
bool is_hist_hash_identity(Oid relid, uint64 *res_hash)
{
   uint64 user_hash_sum;
   uint64 hist_hash_sum;
 char hist_name[NAMEDATALEN];
 char *rel_name = get_rel_name(relid);
 if (!get_hist_name(relid, rel_name, hist_name)) {
       ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("get hist table name failed.")));
   }
   Oid histoid = get_relname_relid(hist_name, PG_BLOCKCHAIN_NAMESPACE);
 if (!OidIsValid(histoid)) {
       ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("could not find hist table of \"%s\".", rel_name)));
   }
   user_hash_sum = get_usertable_hash_sum(relid);
   hist_hash_sum = get_histtable_hash_sum(histoid);
   *res_hash = hist_hash_sum;
 return user_hash_sum == hist_hash_sum;
}

2、查詢防篡改用戶表ledgernsp.usertable與其對應的歷史表以及全域區塊表中關于該表的記錄是否一致,

omm=# SELECT pg_catalog.ledger_gchain_check('ledgernsp', 'usertable');
ledger_gchain_check
---------------------
t
(1 row)
  • 校驗是否為賬本表ledger_usertable_check
  • 校驗用戶權限has_ledger_consistent_privilege
  • 校驗歷史表hash值is_hist_hash_identity
  • 計算/校驗全域表hash get_gchain_relhash_sum
/*
* get_gchain_relhash_sum -- calculate relhash from gs_global_chain
*
* relid: user table oid
*/
static uint64 get_gchain_relhash_sum(Oid relid)
{
   uint64 relhash = 0;
   HeapTuple tuple = NULL;
 /* scan the gs_global_chain catalog by relid */
   Relation gchain_rel = heap_open(GsGlobalChainRelationId, AccessShareLock);
   Form_gs_global_chain rdata = NULL;
   TableScanDesc scan = heap_beginscan(gchain_rel, SnapshotNow, 0, NULL);
 while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL) {
       rdata = (Form_gs_global_chain)GETSTRUCT(tuple);
 if (rdata =https://www.cnblogs.com/huaweiyun/p/= NULL || rdata->relid != relid) {
 continue;
       }
       relhash += rdata->relhash;
   }
   heap_endscan(scan);
   heap_close(gchain_rel, AccessShareLock);
 return relhash;
}

歸檔賬本資料庫

官方檔案

前提條件:

  • 系統中需要有審計管理員或者具有審計管理員權限的角色,
  • 資料庫正常運行,并且對防篡改資料庫執行了一系列增、刪、改等操作,保證在查詢時段內有賬本操作記錄結果產生,
  • 資料庫已經正確配置審計檔案的存盤路徑audit_directory,

基本操作

1、對指定用戶歷史表進行歸檔操作,

omm=# SELECT pg_catalog.ledger_hist_archive('ledgernsp', 'usertable');
ledger_hist_archive
---------------------
t
(1 row)
omm=# SELECT * FROM blockchain.ledgernsp_usertable_hist;
rec_num |     hash_ins     |     hash_del     |             pre_hash
---------+------------------+------------------+----------------------------------
 4 | e78e75b00d396899 | 84e8bfc3b974e9cf | 6475a497b7a272a92bab012d7f3d615b
(1 row)

主要步驟如下:

  1. Copy user history table.
  2. Do unify and truncate.
  3. sum all hash_ins and hash_del for unification.
  4. Do real truncate.heap_truncate_one_rel
  5. Do insertion for unified row.simple_heap_insert
  6. Flush history hash table cache.

2、執行全域區塊表匯出操作

omm=# SELECT * FROM gs_global_chain;
blocknum | dbname | username |           starttime           | relid |  relnsp   |  relname  |     relhash      |            globalhash            |
                 txcommand
----------+--------+----------+-------------------------------+-------+-----------+-----------+------------------+----------------------------------+----------------
--------------------------------------------------------------
 1 | omm    | omm      | 2022-09-17 13:59:37.84824+00  | 16404 | ledgernsp | usertable | a41714001181a294 | 83927d11ba1fd678e8f4b0723a9cd5f2 | INSERT INTO led
gernsp.usertable VALUES(1, 'alex'), (2, 'bob'), (3, 'peter');
 2 | omm    | omm      | 2022-09-17 13:59:51.723068+00 | 16404 | ledgernsp | usertable | b3a9ed0755131181 | b5ee73b6c20c817230182f6373c78e20 | UPDATE ledgerns
p.usertable SET name = 'bob2' WHERE id = 2;
 3 | omm    | omm      | 2022-09-17 13:59:58.159596+00 | 16404 | ledgernsp | usertable | 0ae4b4e4ed2fcab5 | 0cc9938cf7f1ed7f7f1a03c29954380a | DELETE FROM led
gernsp.usertable WHERE id = 3;
(3 rows)
omm=# SELECT pg_catalog.ledger_gchain_archive();
ledger_gchain_archive
-----------------------
t
(1 row)
omm=# SELECT * FROM gs_global_chain;
blocknum | dbname | username |          starttime           | relid |  relnsp   |  relname  |     relhash      |            globalhash            | txcommand
----------+--------+----------+------------------------------+-------+-----------+-----------+------------------+----------------------------------+-----------
 2 | omm    | omm      | 2022-09-17 13:59:37.84824+00 | 16404 | ledgernsp | usertable | 62a5b5ec53c47eca | 7252d09679b0b3836a2e63da17284ad5 | Archived.
(1 row)

gs_global_chain主要處理流程:

  1. Init and prepare bak dictionary.
  2. Using CopyStmt to copy global chain.
  3. Do unify and truncate.
  4. Using hash table to do unify, each hash_entry refers to one relid informations.
  5. Split gs_global_chain by relid, and accumulate rel_hash to a new record for each rel.
  6. Do rel truncate.
  7. Insert newest record to gchain order by relid.
  8. Flush global_hash cache.

修復賬本資料庫

官方檔案

前提條件:

  • 系統中需要有審計管理員或者具有審計管理員權限的角色,
  • 資料庫正常運行,并且對防篡改資料庫執行了一系列增、刪、改等操作,保證在查詢時段內有賬本操作記錄結果產生,

基本操作

1、執行歷史表修復操作

omm=# select * from blockchain.ledgernsp_usertable_hist;
rec_num |     hash_ins     |     hash_del     |             pre_hash
---------+------------------+------------------+----------------------------------
      4 | e78e75b00d396899 | 84e8bfc3b974e9cf | 6475a497b7a272a92bab012d7f3d615b
(1 row)
omm=# SELECT pg_catalog.ledger_hist_repair('ledgernsp', 'usertable');
ledger_hist_repair
--------------------
0000000000000000
(1 row)

[drawio] (rHmeQ8HWKS_RFXgP-oTUZINZguxBYqh2IV64Y0j5TAA.svg)

2、執行全域區塊表修復操作

omm=# select * from gs_global_chain ;
blocknum | dbname | username |          starttime           | relid |  relnsp   |  relname  |     relhash      |            globalhash            | txcommand
----------+--------+----------+------------------------------+-------+-----------+-----------+------------------+----------------------------------+-----------
       2 | omm    | omm      | 2022-09-17 13:59:37.84824+00 | 16404 | ledgernsp | usertable | 62a5b5ec53c47eca | 7252d09679b0b3836a2e63da17284ad5 | Archived.
(1 row)
omm=# SELECT pg_catalog.ledger_gchain_repair('ledgernsp', 'usertable');
ledger_gchain_repair
----------------------
62a5b5ec53c47eca
(1 row)

首先判斷用戶權限,之后通過get_gchain_relhash_sum函式計算relhash欄位

/*
* get_gchain_relhash_sum -- calculate relhash from gs_global_chain
*
* relid: user table oid
*/
static uint64 get_gchain_relhash_sum(Oid relid)
{
   uint64 relhash = 0;
   HeapTuple tuple = NULL;
 /* scan the gs_global_chain catalog by relid */
   Relation gchain_rel = heap_open(GsGlobalChainRelationId, AccessShareLock);
   Form_gs_global_chain rdata = NULL;
   TableScanDesc scan = heap_beginscan(gchain_rel, SnapshotNow, 0, NULL);
 while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL) {
       rdata = (Form_gs_global_chain)GETSTRUCT(tuple);
 if (rdata =https://www.cnblogs.com/huaweiyun/p/= NULL || rdata->relid != relid) {
 continue;
       }
       relhash += rdata->relhash;
   }
   heap_endscan(scan);
   heap_close(gchain_rel, AccessShareLock);
 return relhash;
}

主要是計算并修復gs_global_chain中的relhash欄位,

總結

賬本資料庫其實并不像我們想象的那么復制,實際上就是利用了區塊鏈的最基本的原理,即當前記錄的特征值 + 上一條記錄特征值的hash值,再進行hash,下一條與上一條記錄具有資料關聯性,形成“鏈”的結構,如果篡改了其中的資料,則會導致“鏈”斷開,導致不能與后面資料記錄形成hash關聯,_hist表記錄了用戶表每一步資料變化的程序,gs_global_chain表記錄了所有防篡改模式下對用戶表的操作記錄,用戶表結合_hist和global表就能完整記錄和校驗,

 

點擊關注,第一時間了解華為云新鮮技術~

轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/535261.html

標籤:其它

上一篇:Babelfish簡介

下一篇:這次,聽人大教授講講分布式資料庫的多級一致性|TDSQL 關鍵技術突破

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • GPU虛擬機創建時間深度優化

    **?桔妹導讀:**GPU虛擬機實體創建速度慢是公有云面臨的普遍問題,由于通常情況下創建虛擬機屬于低頻操作而未引起業界的重視,實際生產中還是存在對GPU實體創建時間有苛刻要求的業務場景。本文將介紹滴滴云在解決該問題時的思路、方法、并展示最終的優化成果。 從公有云服務商那里購買過虛擬主機的資深用戶,一 ......

    uj5u.com 2020-09-10 06:09:13 more
  • 可編程網卡芯片在滴滴云網路的應用實踐

    **?桔妹導讀:**隨著云規模不斷擴大以及業務層面對延遲、帶寬的要求越來越高,采用DPDK 加速網路報文處理的方式在橫向縱向擴展都出現了局限性。可編程芯片成為業界熱點。本文主要講述了可編程網卡芯片在滴滴云網路中的應用實踐,遇到的問題、帶來的收益以及開源社區貢獻。 #1. 資料中心面臨的問題 隨著滴滴 ......

    uj5u.com 2020-09-10 06:10:21 more
  • 滴滴資料通道服務演進之路

    **?桔妹導讀:**滴滴資料通道引擎承載著全公司的資料同步,為下游實時和離線場景提供了必不可少的源資料。隨著任務量的不斷增加,資料通道的整體架構也隨之發生改變。本文介紹了滴滴資料通道的發展歷程,遇到的問題以及今后的規劃。 #1. 背景 資料,對于任何一家互聯網公司來說都是非常重要的資產,公司的大資料 ......

    uj5u.com 2020-09-10 06:11:05 more
  • 滴滴AI Labs斬獲國際機器翻譯大賽中譯英方向世界第三

    **桔妹導讀:**深耕人工智能領域,致力于探索AI讓出行更美好的滴滴AI Labs再次斬獲國際大獎,這次獲獎的專案是什么呢?一起來看看詳細報道吧! 近日,由國際計算語言學協會ACL(The Association for Computational Linguistics)舉辦的世界最具影響力的機器 ......

    uj5u.com 2020-09-10 06:11:29 more
  • MPP (Massively Parallel Processing)大規模并行處理

    1、什么是mpp? MPP (Massively Parallel Processing),即大規模并行處理,在資料庫非共享集群中,每個節點都有獨立的磁盤存盤系統和記憶體系統,業務資料根據資料庫模型和應用特點劃分到各個節點上,每臺資料節點通過專用網路或者商業通用網路互相連接,彼此協同計算,作為整體提供 ......

    uj5u.com 2020-09-10 06:11:41 more
  • 滴滴資料倉庫指標體系建設實踐

    **桔妹導讀:**指標體系是什么?如何使用OSM模型和AARRR模型搭建指標體系?如何統一流程、規范化、工具化管理指標體系?本文會對建設的方法論結合滴滴資料指標體系建設實踐進行解答分析。 #1. 什么是指標體系 ##1.1 指標體系定義 指標體系是將零散單點的具有相互聯系的指標,系統化的組織起來,通 ......

    uj5u.com 2020-09-10 06:12:52 more
  • 單表千萬行資料庫 LIKE 搜索優化手記

    我們經常在資料庫中使用 LIKE 運算子來完成對資料的模糊搜索,LIKE 運算子用于在 WHERE 子句中搜索列中的指定模式。 如果需要查找客戶表中所有姓氏是“張”的資料,可以使用下面的 SQL 陳述句: SELECT * FROM Customer WHERE Name LIKE '張%' 如果需要 ......

    uj5u.com 2020-09-10 06:13:25 more
  • 滴滴Ceph分布式存盤系統優化之鎖優化

    **桔妹導讀:**Ceph是國際知名的開源分布式存盤系統,在工業界和學術界都有著重要的影響。Ceph的架構和演算法設計發表在國際系統領域頂級會議OSDI、SOSP、SC等上。Ceph社區得到Red Hat、SUSE、Intel等大公司的大力支持。Ceph是國際云計算領域應用最廣泛的開源分布式存盤系統, ......

    uj5u.com 2020-09-10 06:14:51 more
  • es~通過ElasticsearchTemplate進行聚合~嵌套聚合

    之前寫過《es~通過ElasticsearchTemplate進行聚合操作》的文章,這一次主要寫一個嵌套的聚合,例如先對sex集合,再對desc聚合,最后再對age求和,共三層嵌套。 Aggregations的部分特性類似于SQL語言中的group by,avg,sum等函式,Aggregation ......

    uj5u.com 2020-09-10 06:14:59 more
  • 爬蟲日志監控 -- Elastc Stack(ELK)部署

    傻瓜式部署,只需替換IP與用戶 導讀: 現ELK四大組件分別為:Elasticsearch(核心)、logstash(處理)、filebeat(采集)、kibana(可視化) 下載均在https://www.elastic.co/cn/downloads/下tar包,各組件版本最好一致,配合fdm會 ......

    uj5u.com 2020-09-10 06:15:05 more
最新发布
  • day02-2-商鋪查詢快取

    功能02-商鋪查詢快取 3.商鋪詳情快取查詢 3.1什么是快取? 快取就是資料交換的緩沖區(稱作Cache),是存盤資料的臨時地方,一般讀寫性能較高。 快取的作用: 降低后端負載 提高讀寫效率,降低回應時間 快取的成本: 資料一致性成本 代碼維護成本 運維成本 3.2需求說明 如下,當我們點擊商店詳 ......

    uj5u.com 2023-04-20 08:33:24 more
  • MySQL中binlog備份腳本分享

    關于MySQL的二進制日志(binlog),我們都知道二進制日志(binlog)非常重要,尤其當你需要point to point災難恢復的時侯,所以我們要對其進行備份。關于二進制日志(binlog)的備份,可以基于flush logs方式先切換binlog,然后拷貝&壓縮到到遠程服務器或本地服務器 ......

    uj5u.com 2023-04-20 08:28:06 more
  • day02-短信登錄

    功能實作02 2.功能01-短信登錄 2.1基于Session實作登錄 2.1.1思路分析 2.1.2代碼實作 2.1.2.1發送短信驗證碼 發送短信驗證碼: 發送驗證碼的介面為:http://127.0.0.1:8080/api/user/code?phone=xxxxx<手機號> 請求方式:PO ......

    uj5u.com 2023-04-20 08:27:27 more
  • 快取與資料庫雙寫一致性幾種策略分析

    本文將對幾種快取與資料庫保證資料一致性的使用方式進行分析。為保證高并發性能,以下分析場景不考慮執行的原子性及加鎖等強一致性要求的場景,僅追求最終一致性。 ......

    uj5u.com 2023-04-20 08:26:48 more
  • sql陳述句優化

    問題查找及措施 問題查找 需要找到具體的代碼,對其進行一對一優化,而非一直把關注點放在服務器和sql平臺 降低簡化每個事務中處理的問題,盡量不要讓一個事務拖太長的時間 例如檔案上傳時,應將檔案上傳這一步放在事務外面 微軟建議 4.啟動sql定時執行計劃 怎么啟動sqlserver代理服務-百度經驗 ......

    uj5u.com 2023-04-20 08:26:35 more
  • 云時代,MySQL到ClickHouse資料同步產品對比推薦

    ClickHouse 在執行分析查詢時的速度優勢很好的彌補了MySQL的不足,但是對于很多開發者和DBA來說,如何將MySQL穩定、高效、簡單的同步到 ClickHouse 卻很困難。本文對比了 NineData、MaterializeMySQL(ClickHouse自帶)、Bifrost 三款產品... ......

    uj5u.com 2023-04-20 08:26:29 more
  • sql陳述句優化

    問題查找及措施 問題查找 需要找到具體的代碼,對其進行一對一優化,而非一直把關注點放在服務器和sql平臺 降低簡化每個事務中處理的問題,盡量不要讓一個事務拖太長的時間 例如檔案上傳時,應將檔案上傳這一步放在事務外面 微軟建議 4.啟動sql定時執行計劃 怎么啟動sqlserver代理服務-百度經驗 ......

    uj5u.com 2023-04-20 08:25:13 more
  • Redis 報”OutOfDirectMemoryError“(堆外記憶體溢位)

    Redis 報錯“OutOfDirectMemoryError(堆外記憶體溢位) ”問題如下: 一、報錯資訊: 使用 Redis 的業務介面 ,產生 OutOfDirectMemoryError(堆外記憶體溢位),如圖: 格式化后的報錯資訊: { "timestamp": "2023-04-17 22: ......

    uj5u.com 2023-04-20 08:24:54 more
  • day02-2-商鋪查詢快取

    功能02-商鋪查詢快取 3.商鋪詳情快取查詢 3.1什么是快取? 快取就是資料交換的緩沖區(稱作Cache),是存盤資料的臨時地方,一般讀寫性能較高。 快取的作用: 降低后端負載 提高讀寫效率,降低回應時間 快取的成本: 資料一致性成本 代碼維護成本 運維成本 3.2需求說明 如下,當我們點擊商店詳 ......

    uj5u.com 2023-04-20 08:24:03 more
  • day02-短信登錄

    功能實作02 2.功能01-短信登錄 2.1基于Session實作登錄 2.1.1思路分析 2.1.2代碼實作 2.1.2.1發送短信驗證碼 發送短信驗證碼: 發送驗證碼的介面為:http://127.0.0.1:8080/api/user/code?phone=xxxxx<手機號> 請求方式:PO ......

    uj5u.com 2023-04-20 08:23:11 more