Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
b36cb698
Commit
b36cb698
authored
Sep 21, 2016
by
Leigh B Stoller
Browse files
Check for existing dataset (same pid/id) while we have the lock.
parent
4603e0dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
apt/APT_Dataset.pm.in
View file @
b36cb698
...
...
@@ -182,6 +182,8 @@ sub Refresh($)
sub
Create
($$)
{
my
($
class
,
$
argref
)
=
@
_
;
my
$
pid
=
$
argref
->{
'pid'
};
my
$
id
=
$
argref
->{
'dataset_id'
};
my
$
uuid
;
if
(
exists
($
argref
->{
'uuid'
}))
{
...
...
@@ -208,6 +210,16 @@ sub Create($$)
return
undef
;
}
$
query_result
=
DBQueryWarn
(
"select uuid from apt_datasets "
.
"where pid='$pid' and dataset_id='$id'"
);
if
($
query_result
->
numrows
)
{
DBQueryWarn
(
"unlock tables"
);
tberror
(
"Dataset $pid/$id already exists!"
);
return
undef
;
}
my
$
query
=
"insert into apt_datasets set "
.
" locked=now(),locker_pid='$PID', "
.
" idx='$idx',created=now(),uuid='$uuid', "
.
...
...
apt/manage_dataset.in
View file @
b36cb698
...
...
@@ -339,7 +339,7 @@ sub DoCreate()
my
$dataset
=
APT_Dataset
->
Create
(
$blob
);
if
(
!
defined
(
$dataset
))
{
fatal
("
Internal e
rror creating dataset object
");
fatal
("
E
rror creating dataset object
");
}
# new dataset is returned locked. If we have instance, try to lock
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment