-db tests pass again
This commit is contained in:
parent
cf2e37cd87
commit
c86c92200c
@ -404,22 +404,22 @@ INSERT INTO exchange_tables
|
||||
,'exchange-0002'
|
||||
,'create'
|
||||
,TRUE
|
||||
,FALSE),
|
||||
,TRUE),
|
||||
('deposits_by_ready'
|
||||
,'exchange-0002'
|
||||
,'constrain'
|
||||
,TRUE
|
||||
,FALSE),
|
||||
,TRUE),
|
||||
('deposits_for_matching'
|
||||
,'exchange-0002'
|
||||
,'create'
|
||||
,TRUE
|
||||
,FALSE),
|
||||
,TRUE),
|
||||
('deposits_for_matching'
|
||||
,'exchange-0002'
|
||||
,'constrain'
|
||||
,TRUE
|
||||
,FALSE),
|
||||
,TRUE),
|
||||
('deposits'
|
||||
,'exchange-0002'
|
||||
,'master'
|
||||
|
@ -132,14 +132,25 @@ BEGIN
|
||||
,table_name
|
||||
,partition_suffix
|
||||
);
|
||||
END $$;
|
||||
|
||||
|
||||
CREATE FUNCTION constrain_table_reserves_out_by_reserve(
|
||||
IN partition_suffix VARCHAR DEFAULT NULL
|
||||
)
|
||||
RETURNS VOID
|
||||
LANGUAGE plpgsql
|
||||
AS $$
|
||||
DECLARE
|
||||
table_name VARCHAR DEFAULT 'reserves_out_by_reserve';
|
||||
BEGIN
|
||||
table_name = concat_ws('_', table_name, partition_suffix);
|
||||
EXECUTE FORMAT (
|
||||
'CREATE INDEX ' || table_name || '_main_index '
|
||||
'ON ' || table_name || ' '
|
||||
'(reserve_uuid);'
|
||||
);
|
||||
END
|
||||
$$;
|
||||
END $$;
|
||||
|
||||
|
||||
CREATE FUNCTION reserves_out_by_reserve_insert_trigger()
|
||||
@ -217,6 +228,11 @@ INSERT INTO exchange_tables
|
||||
,'create'
|
||||
,TRUE
|
||||
,FALSE),
|
||||
('reserves_out_by_reserve'
|
||||
,'exchange-0002'
|
||||
,'constrain'
|
||||
,TRUE
|
||||
,FALSE),
|
||||
('reserves_out'
|
||||
,'exchange-0002'
|
||||
,'master'
|
||||
|
@ -177,7 +177,7 @@ BEGIN
|
||||
'SELECT exchange.%s_table_%s (%s)'::text
|
||||
,rec.action
|
||||
,rec.name
|
||||
,0
|
||||
,quote_literal('0')
|
||||
);
|
||||
IF (rec.by_range OR
|
||||
(num_partitions = 0))
|
||||
@ -189,7 +189,7 @@ BEGIN
|
||||
EXECUTE FORMAT(
|
||||
'CREATE TABLE exchange.%s_default'
|
||||
' PARTITION OF %s'
|
||||
' FOR DEFAULT'
|
||||
' DEFAULT'
|
||||
,rec.name
|
||||
,rec.name
|
||||
);
|
||||
@ -238,14 +238,15 @@ BEGIN
|
||||
,rec.name
|
||||
);
|
||||
ELSE
|
||||
IF (num_partitions = 0)
|
||||
IF ( (num_partitions = 0) OR
|
||||
(rec.by_range) )
|
||||
THEN
|
||||
-- Constrain default table
|
||||
EXECUTE FORMAT(
|
||||
'SELECT exchange.%s_table_%s (%s)'::text
|
||||
,rec.action
|
||||
,rec.name
|
||||
,'default'
|
||||
,quote_literal('default')
|
||||
);
|
||||
ELSE
|
||||
-- Constrain each partition
|
||||
@ -254,7 +255,7 @@ BEGIN
|
||||
'SELECT exchange.%s_table_%s (%s)'::text
|
||||
,rec.action
|
||||
,rec.name
|
||||
,i
|
||||
,quote_literal(i)
|
||||
);
|
||||
END LOOP;
|
||||
END IF;
|
||||
|
@ -83,21 +83,14 @@ run (void *cls)
|
||||
}
|
||||
(void) plugin->drop_tables (plugin->cls);
|
||||
if (GNUNET_OK !=
|
||||
plugin->create_tables (plugin->cls))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
result = 77;
|
||||
goto cleanup;
|
||||
}
|
||||
if (GNUNET_OK !=
|
||||
plugin->setup_partitions (plugin->cls,
|
||||
plugin->create_tables (plugin->cls,
|
||||
true,
|
||||
num_partitions))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
result = 77;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i< 8; i++)
|
||||
{
|
||||
static unsigned int batches[] = {1, 1, 0, 2, 4, 16, 64, 256};
|
||||
@ -114,7 +107,7 @@ run (void *cls)
|
||||
&value));
|
||||
now = GNUNET_TIME_absolute_get ();
|
||||
ts = GNUNET_TIME_timestamp_get ();
|
||||
for (unsigned int r=0;r<10;r++)
|
||||
for (unsigned int r = 0; r<10; r++)
|
||||
{
|
||||
plugin->start (plugin->cls,
|
||||
"test_by_exchange_j");
|
||||
@ -196,4 +189,5 @@ main (int argc,
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/* end of test_exchangedb_by_j.c */
|
||||
|
@ -1245,13 +1245,9 @@ run (void *cls)
|
||||
}
|
||||
(void) plugin->drop_tables (plugin->cls);
|
||||
if (GNUNET_OK !=
|
||||
plugin->create_tables (plugin->cls))
|
||||
{
|
||||
result = 77;
|
||||
goto cleanup;
|
||||
}
|
||||
if (GNUNET_OK !=
|
||||
plugin->setup_partitions (plugin->cls, num_partitions))
|
||||
plugin->create_tables (plugin->cls,
|
||||
true,
|
||||
num_partitions))
|
||||
{
|
||||
result = 77;
|
||||
goto cleanup;
|
||||
|
@ -83,21 +83,14 @@ run (void *cls)
|
||||
}
|
||||
(void) plugin->drop_tables (plugin->cls);
|
||||
if (GNUNET_OK !=
|
||||
plugin->create_tables (plugin->cls))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
result = 77;
|
||||
goto cleanup;
|
||||
}
|
||||
if (GNUNET_OK !=
|
||||
plugin->setup_partitions (plugin->cls,
|
||||
plugin->create_tables (plugin->cls,
|
||||
true,
|
||||
num_partitions))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
result = 77;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i< 7; i++)
|
||||
{
|
||||
static unsigned int batches[] = {1, 1, 2, 4, 16, 64, 256};
|
||||
@ -114,7 +107,7 @@ run (void *cls)
|
||||
&value));
|
||||
now = GNUNET_TIME_absolute_get ();
|
||||
ts = GNUNET_TIME_timestamp_get ();
|
||||
for (unsigned int r=0;r<10;r++)
|
||||
for (unsigned int r = 0; r<10; r++)
|
||||
{
|
||||
plugin->start_read_committed (plugin->cls,
|
||||
"test_by_j");
|
||||
@ -201,4 +194,5 @@ main (int argc,
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/* end of test_exchangedb_by_j.c */
|
||||
|
Loading…
Reference in New Issue
Block a user