-
Notifications
You must be signed in to change notification settings - Fork 696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added failure test for create index concurrently #2210
Conversation
|
||
(1 row) | ||
|
||
CREATE INDEX CONCURRENTLY idx_index_test ON index_test(id, value_1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could maybe add a cancellation test as well?
8eea61c
to
9133912
Compare
3121431
to
6c01440
Compare
6c01440
to
3e309e3
Compare
Codecov Report
@@ Coverage Diff @@
## master #2210 +/- ##
==========================================
+ Coverage 93.27% 93.77% +0.49%
==========================================
Files 110 110
Lines 27215 27477 +262
==========================================
+ Hits 25385 25766 +381
+ Misses 1830 1711 -119 |
05af0df
to
6749b10
Compare
35ea52f
to
7d24e08
Compare
@@ -0,0 +1,65 @@ | |||
-- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering this comment and thinking about this PR as the main one for bare DDLs, I could suggest three more tests:
- Test with replication factor 1 as well (I think the default in the regression test suite is two, but, please double check that)
- Add tests for DROP INDEX CONCURRENTLY as well.
- Since the
CREATE/DROP INDEX CONCURRENTLY
uses sequential execution mode, we could kill/cancel the second (or later) commands over a single connection. For example, if you create 8 shards, we'd end up with 4 shards per worker and 4 shards are modified over the same connection per node. So, say if you havewhatevercase().after(2).kill()
, it'd kill the connection after seeing the same command 2 times. An example can be found here
HINT: Use DROP INDEX CONCURRENTLY IF EXISTS to remove the invalid index, then retry the original command. | ||
SELECT citus.dump_network_traffic(); | ||
dump_network_traffic | ||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a discussion we've made with @lithp as well, but we haven't concluded the discussion.
I think this dump_network_traffic ()
is super useful by itself both during development and debugging. But, do you see necessary to add to regression tests? I'm OK with keeping it, but I don't add them to the PRs that I open because they seem too verbose to add to the output. I even hit few cases where the output isn't consistent such as here. (I don't expect inconsistencies for this case, but, just wanted to note)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're right that they're too verbose to add to every line. A style that I think makes sense is to show the dump just once at the top, run a happy-case so future readers can see exactly what the rest of the test is mucking with. These two dumps don't really show me what is supposed to happen, they just show the same truncated log twice.
I don't want to impose that style on anyone though if they don't agree with it.
|
||
(1 row) | ||
|
||
SELECT citus.clear_network_traffic(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no need to call clear_network_traffic()
if you're not going to dump afterwards. All it does it empty the buffer of captured packets.
|
@lithp @onderkalaci I am not really enjoying |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can simply add that in this PR:
diff --git a/src/test/regress/pg_regress_multi.pl b/src/test/regress/pg_regress_multi.pl
index 6274a83..3389728 100755
--- a/src/test/regress/pg_regress_multi.pl
+++ b/src/test/regress/pg_regress_multi.pl
@@ -262,6 +262,8 @@ for (my $workerIndex = 1; $workerIndex <= $workerCount; $workerIndex++) {
push(@workerPorts, $workerPort);
}
+my $workerBehindProxyPort = $workerPorts[1] + 2;
+
my $followerCoordPort = 9070;
my @followerWorkerPorts = ();
for (my $workerIndex = 1; $workerIndex <= $workerCount; $workerIndex++) {
@@ -417,6 +419,7 @@ if ($usingWindows)
}
print $fh catfile($bindir, "psql")." ";
print $fh "--variable=master_port=$masterPort ";
+print $fh "--variable=worker_2_proxy_port=$workerBehindProxyPort ";
print $fh "--variable=follower_master_port=$followerCoordPort ";
print $fh "--variable=default_user=$user ";
print $fh "--variable=SHOW_CONTEXT=always ";
@@ -425,6 +428,9 @@ for my $workeroff (0 .. $#workerPorts)
my $port = $workerPorts[$workeroff];
print $fh "--variable=worker_".($workeroff+1)."_port=$port ";
}
or maybe with a very minor syntax difference. If you are to add the port to the regression tests, consider the minor comment as well.
SELECT * FROM run_command_on_workers($$SELECT count(*) FROM pg_indexes WHERE indexname LIKE 'idx_index_test%' $$) | ||
WHERE nodeport = :worker_2_proxy_port; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty minor: extra new lines
|
||
-- verify index is not created | ||
SELECT * FROM run_command_on_workers($$SELECT count(*) FROM pg_indexes WHERE indexname LIKE 'idx_index_test%' $$) | ||
WHERE nodeport = :worker_2_proxy_port; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another way would have been to write WHERE nodeport != :worker_1_port
@@ -417,6 +419,7 @@ sub revert_replace_postgres | |||
} | |||
print $fh catfile($bindir, "psql")." "; | |||
print $fh "--variable=master_port=$masterPort "; | |||
print $fh "--variable=worker_2_proxy_port=$workerBehindProxyPort "; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also change :worker_2_port
and have it always point at the proxy, that sounds like a cleaner option.
No description provided.