add permissions
This commit is contained in:
parent
45916b992b
commit
0ba219fe5b
@ -1560,6 +1560,7 @@ CREATE OR REPLACE FUNCTION create_foreign_table(
|
|||||||
,modulus INTEGER
|
,modulus INTEGER
|
||||||
,shard_suffix VARCHAR
|
,shard_suffix VARCHAR
|
||||||
,current_shard_num INTEGER
|
,current_shard_num INTEGER
|
||||||
|
,local_user VARCHAR DEFAULT 'taler-exchange-httpd'
|
||||||
)
|
)
|
||||||
RETURNS VOID
|
RETURNS VOID
|
||||||
LANGUAGE plpgsql
|
LANGUAGE plpgsql
|
||||||
@ -1581,14 +1582,15 @@ BEGIN
|
|||||||
);
|
);
|
||||||
|
|
||||||
EXECUTE FORMAT(
|
EXECUTE FORMAT(
|
||||||
'ALTER FOREIGN TABLE %I OWNER TO "taler-exchange-httpd"',
|
'ALTER FOREIGN TABLE %I OWNER TO %L'
|
||||||
source_table_name || '_' || shard_suffix
|
,source_table_name || '_' || shard_suffix
|
||||||
|
,local_user
|
||||||
);
|
);
|
||||||
|
|
||||||
END
|
END
|
||||||
$$;
|
$$;
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION master_prepare_sharding()
|
CREATE OR REPLACE FUNCTION prepare_sharding()
|
||||||
RETURNS VOID
|
RETURNS VOID
|
||||||
LANGUAGE plpgsql
|
LANGUAGE plpgsql
|
||||||
AS $$
|
AS $$
|
||||||
@ -1717,131 +1719,160 @@ BEGIN
|
|||||||
,remote_user_password
|
,remote_user_password
|
||||||
);
|
);
|
||||||
|
|
||||||
|
EXECUTE FORMAT(
|
||||||
|
'GRANT ALL PRIVILEGES '
|
||||||
|
'ON FOREIGN SERVER %I '
|
||||||
|
'TO %L;'
|
||||||
|
,shard_suffix
|
||||||
|
,local_user
|
||||||
|
);
|
||||||
|
|
||||||
PERFORM create_foreign_table(
|
PERFORM create_foreign_table(
|
||||||
'wire_targets'
|
'wire_targets'
|
||||||
,total_num_shards
|
,total_num_shards
|
||||||
,shard_suffix
|
,shard_suffix
|
||||||
,current_shard_num
|
,current_shard_num
|
||||||
|
,local_user
|
||||||
);
|
);
|
||||||
PERFORM create_foreign_table(
|
PERFORM create_foreign_table(
|
||||||
'reserves'
|
'reserves'
|
||||||
,total_num_shards
|
,total_num_shards
|
||||||
,shard_suffix
|
,shard_suffix
|
||||||
,current_shard_num
|
,current_shard_num
|
||||||
|
,local_user
|
||||||
);
|
);
|
||||||
PERFORM create_foreign_table(
|
PERFORM create_foreign_table(
|
||||||
'reserves_in'
|
'reserves_in'
|
||||||
,total_num_shards
|
,total_num_shards
|
||||||
,shard_suffix
|
,shard_suffix
|
||||||
,current_shard_num
|
,current_shard_num
|
||||||
|
,local_user
|
||||||
);
|
);
|
||||||
PERFORM create_foreign_table(
|
PERFORM create_foreign_table(
|
||||||
'reserves_out'
|
'reserves_out'
|
||||||
,total_num_shards
|
,total_num_shards
|
||||||
,shard_suffix
|
,shard_suffix
|
||||||
,current_shard_num
|
,current_shard_num
|
||||||
|
,local_user
|
||||||
);
|
);
|
||||||
PERFORM create_foreign_table(
|
PERFORM create_foreign_table(
|
||||||
'reserves_close'
|
'reserves_close'
|
||||||
,total_num_shards
|
,total_num_shards
|
||||||
,shard_suffix
|
,shard_suffix
|
||||||
,current_shard_num
|
,current_shard_num
|
||||||
|
,local_user
|
||||||
);
|
);
|
||||||
PERFORM create_foreign_table(
|
PERFORM create_foreign_table(
|
||||||
'known_coins'
|
'known_coins'
|
||||||
,total_num_shards
|
,total_num_shards
|
||||||
,shard_suffix
|
,shard_suffix
|
||||||
,current_shard_num
|
,current_shard_num
|
||||||
|
,local_user
|
||||||
);
|
);
|
||||||
PERFORM create_foreign_table(
|
PERFORM create_foreign_table(
|
||||||
'refresh_commitments'
|
'refresh_commitments'
|
||||||
,total_num_shards
|
,total_num_shards
|
||||||
,shard_suffix
|
,shard_suffix
|
||||||
,current_shard_num
|
,current_shard_num
|
||||||
|
,local_user
|
||||||
);
|
);
|
||||||
PERFORM create_foreign_table(
|
PERFORM create_foreign_table(
|
||||||
'refresh_revealed_coins'
|
'refresh_revealed_coins'
|
||||||
,total_num_shards
|
,total_num_shards
|
||||||
,shard_suffix
|
,shard_suffix
|
||||||
,current_shard_num
|
,current_shard_num
|
||||||
|
,local_user
|
||||||
);
|
);
|
||||||
PERFORM create_foreign_table(
|
PERFORM create_foreign_table(
|
||||||
'refresh_transfer_keys'
|
'refresh_transfer_keys'
|
||||||
,total_num_shards
|
,total_num_shards
|
||||||
,shard_suffix
|
,shard_suffix
|
||||||
,current_shard_num
|
,current_shard_num
|
||||||
|
,local_user
|
||||||
);
|
);
|
||||||
PERFORM create_foreign_table(
|
PERFORM create_foreign_table(
|
||||||
'deposits'
|
'deposits'
|
||||||
,total_num_shards
|
,total_num_shards
|
||||||
,shard_suffix
|
,shard_suffix
|
||||||
,current_shard_num
|
,current_shard_num
|
||||||
|
,local_user
|
||||||
);
|
);
|
||||||
-- PERFORM create_foreign_table(
|
-- PERFORM create_foreign_table(
|
||||||
-- 'deposits_by_ready'
|
-- 'deposits_by_ready'
|
||||||
-- ,total_num_shards
|
-- ,total_num_shards
|
||||||
-- ,shard_suffix
|
-- ,shard_suffix
|
||||||
-- ,current_shard_num
|
-- ,current_shard_num
|
||||||
|
-- ,local_user
|
||||||
-- );
|
-- );
|
||||||
-- PERFORM create_foreign_table(
|
-- PERFORM create_foreign_table(
|
||||||
-- 'deposits_for_matching'
|
-- 'deposits_for_matching'
|
||||||
-- ,total_num_shards
|
-- ,total_num_shards
|
||||||
-- ,shard_suffix
|
-- ,shard_suffix
|
||||||
-- ,current_shard_num
|
-- ,current_shard_num
|
||||||
|
-- ,local_user
|
||||||
-- );
|
-- );
|
||||||
PERFORM create_foreign_table(
|
PERFORM create_foreign_table(
|
||||||
'refunds'
|
'refunds'
|
||||||
,total_num_shards
|
,total_num_shards
|
||||||
,shard_suffix
|
,shard_suffix
|
||||||
,current_shard_num
|
,current_shard_num
|
||||||
|
,local_user
|
||||||
);
|
);
|
||||||
PERFORM create_foreign_table(
|
PERFORM create_foreign_table(
|
||||||
'wire_out'
|
'wire_out'
|
||||||
,total_num_shards
|
,total_num_shards
|
||||||
,shard_suffix
|
,shard_suffix
|
||||||
,current_shard_num
|
,current_shard_num
|
||||||
|
,local_user
|
||||||
);
|
);
|
||||||
PERFORM create_foreign_table(
|
PERFORM create_foreign_table(
|
||||||
'aggregation_tracking'
|
'aggregation_tracking'
|
||||||
,total_num_shards
|
,total_num_shards
|
||||||
,shard_suffix
|
,shard_suffix
|
||||||
,current_shard_num
|
,current_shard_num
|
||||||
|
,local_user
|
||||||
);
|
);
|
||||||
PERFORM create_foreign_table(
|
PERFORM create_foreign_table(
|
||||||
'recoup'
|
'recoup'
|
||||||
,total_num_shards
|
,total_num_shards
|
||||||
,shard_suffix
|
,shard_suffix
|
||||||
,current_shard_num
|
,current_shard_num
|
||||||
|
,local_user
|
||||||
);
|
);
|
||||||
PERFORM create_foreign_table(
|
PERFORM create_foreign_table(
|
||||||
'recoup_by_reserve'
|
'recoup_by_reserve'
|
||||||
,total_num_shards
|
,total_num_shards
|
||||||
,shard_suffix
|
,shard_suffix
|
||||||
,current_shard_num
|
,current_shard_num
|
||||||
|
,local_user
|
||||||
);
|
);
|
||||||
PERFORM create_foreign_table(
|
PERFORM create_foreign_table(
|
||||||
'reserves_out_by_reserve'
|
'reserves_out_by_reserve'
|
||||||
,total_num_shards
|
,total_num_shards
|
||||||
,shard_suffix
|
,shard_suffix
|
||||||
,current_shard_num
|
,current_shard_num
|
||||||
|
,local_user
|
||||||
);
|
);
|
||||||
PERFORM create_foreign_table(
|
PERFORM create_foreign_table(
|
||||||
'recoup_refresh'
|
'recoup_refresh'
|
||||||
,total_num_shards
|
,total_num_shards
|
||||||
,shard_suffix
|
,shard_suffix
|
||||||
,current_shard_num
|
,current_shard_num
|
||||||
|
,local_user
|
||||||
);
|
);
|
||||||
PERFORM create_foreign_table(
|
PERFORM create_foreign_table(
|
||||||
'prewire'
|
'prewire'
|
||||||
,total_num_shards
|
,total_num_shards
|
||||||
,shard_suffix
|
,shard_suffix
|
||||||
,current_shard_num
|
,current_shard_num
|
||||||
|
,local_user
|
||||||
);
|
);
|
||||||
PERFORM create_foreign_table(
|
PERFORM create_foreign_table(
|
||||||
'cs_nonce_locks'
|
'cs_nonce_locks'
|
||||||
,total_num_shards
|
,total_num_shards
|
||||||
,shard_suffix
|
,shard_suffix
|
||||||
,current_shard_num
|
,current_shard_num
|
||||||
|
,local_user
|
||||||
);
|
);
|
||||||
|
|
||||||
END
|
END
|
||||||
@ -1860,7 +1891,7 @@ CREATE OR REPLACE FUNCTION create_foreign_servers(
|
|||||||
AS $$
|
AS $$
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
PERFORM master_prepare_sharding();
|
PERFORM prepare_sharding();
|
||||||
|
|
||||||
FOR i IN 1..amount LOOP
|
FOR i IN 1..amount LOOP
|
||||||
PERFORM create_shard_server(
|
PERFORM create_shard_server(
|
||||||
|
Loading…
Reference in New Issue
Block a user