Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dCache
cta
Commits
e3853a79
Commit
e3853a79
authored
7 years ago
by
Steven Murray
Browse files
Options
Downloads
Patches
Plain Diff
Added autocommitMode parameter to SqliteCatalogue::selectTape()
parent
cc4beddb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
catalogue/SqliteCatalogue.cpp
+10
-4
10 additions, 4 deletions
catalogue/SqliteCatalogue.cpp
catalogue/SqliteCatalogue.hpp
+3
-1
3 additions, 1 deletion
catalogue/SqliteCatalogue.hpp
with
13 additions
and
5 deletions
catalogue/SqliteCatalogue.cpp
+
10
−
4
View file @
e3853a79
...
...
@@ -129,7 +129,8 @@ uint64_t SqliteCatalogue::getNextArchiveFileId(rdbms::PooledConn &conn) {
//------------------------------------------------------------------------------
// selectTapeForUpdate
//------------------------------------------------------------------------------
common
::
dataStructures
::
Tape
SqliteCatalogue
::
selectTape
(
rdbms
::
PooledConn
&
conn
,
const
std
::
string
&
vid
)
{
common
::
dataStructures
::
Tape
SqliteCatalogue
::
selectTape
(
const
rdbms
::
Stmt
::
AutocommitMode
autocommitMode
,
rdbms
::
PooledConn
&
conn
,
const
std
::
string
&
vid
)
{
try
{
const
char
*
const
sql
=
"SELECT "
...
...
@@ -167,7 +168,7 @@ common::dataStructures::Tape SqliteCatalogue::selectTape(rdbms::PooledConn &conn
"WHERE "
"VID = :VID;"
;
auto
stmt
=
conn
.
createStmt
(
sql
,
rdbms
::
Stmt
::
A
utocommitMode
::
OFF
);
auto
stmt
=
conn
.
createStmt
(
sql
,
a
utocommitMode
);
stmt
->
bindString
(
":VID"
,
vid
);
auto
rset
=
stmt
->
executeQuery
();
if
(
!
rset
->
next
())
{
...
...
@@ -232,11 +233,16 @@ void SqliteCatalogue::filesWrittenToTape(const std::set<TapeFileWritten> &events
const
auto
&
firstEvent
=
*
firstEventItor
;;
checkTapeFileWrittenFieldsAreSet
(
firstEvent
);
// The SQLite implementation of this method relies on the fact that a tape
// cannot be physically mounted in two or more drives at the same time
//
// Given the above assumption regarding the laws of physics, a simple lock
// on the mutex of the SqliteCatalogue object is enough to emulate an
// Oracle SELECT FOR UPDATE
std
::
lock_guard
<
std
::
mutex
>
m_lock
(
m_mutex
);
auto
conn
=
m_connPool
.
getConn
();
rdbms
::
AutoRollback
autoRollback
(
conn
);
const
auto
tape
=
selectTape
(
conn
,
firstEvent
.
vid
);
const
auto
tape
=
selectTape
(
rdbms
::
Stmt
::
AutocommitMode
::
OFF
,
conn
,
firstEvent
.
vid
);
uint64_t
expectedFSeq
=
tape
.
lastFSeq
+
1
;
uint64_t
totalCompressedBytesWritten
=
0
;
...
...
This diff is collapsed.
Click to expand it.
catalogue/SqliteCatalogue.hpp
+
3
−
1
View file @
e3853a79
...
...
@@ -100,10 +100,12 @@ private:
/**
* Selects the specified tape within the Tape table.
*
* @param autocommitMode The autocommit mode of the statement.
* @param conn The database connection.
* @param vid The volume identifier of the tape.
*/
common
::
dataStructures
::
Tape
selectTape
(
rdbms
::
PooledConn
&
conn
,
const
std
::
string
&
vid
);
common
::
dataStructures
::
Tape
selectTape
(
const
rdbms
::
Stmt
::
AutocommitMode
autocommitMode
,
rdbms
::
PooledConn
&
conn
,
const
std
::
string
&
vid
);
};
// class SqliteCatalogue
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment