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
e0bd4bc4
Commit
e0bd4bc4
authored
6 years ago
by
Eric Cano
Browse files
Options
Downloads
Patches
Plain Diff
Fixed outdated strings (old class name still used).
parent
aa9708fa
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
objectstore/BackendRados.cpp
+16
-16
16 additions, 16 deletions
objectstore/BackendRados.cpp
with
16 additions
and
16 deletions
objectstore/BackendRados.cpp
+
16
−
16
View file @
e0bd4bc4
...
@@ -86,19 +86,19 @@ BackendRados::BackendRados(log::Logger & logger, const std::string & userId, con
...
@@ -86,19 +86,19 @@ BackendRados::BackendRados(log::Logger & logger, const std::string & userId, con
m_user
(
userId
),
m_pool
(
pool
),
m_namespace
(
radosNameSpace
),
m_cluster
(),
m_radosCtxPool
()
{
m_user
(
userId
),
m_pool
(
pool
),
m_namespace
(
radosNameSpace
),
m_cluster
(),
m_radosCtxPool
()
{
log
::
LogContext
lc
(
logger
);
log
::
LogContext
lc
(
logger
);
cta
::
exception
::
Errnum
::
throwOnReturnedErrnoOrThrownStdException
([
&
]()
{
return
-
m_cluster
.
init
(
userId
.
c_str
());},
cta
::
exception
::
Errnum
::
throwOnReturnedErrnoOrThrownStdException
([
&
]()
{
return
-
m_cluster
.
init
(
userId
.
c_str
());},
"In
ObjectStoreRados::ObjectStore
Rados, failed to m_cluster.init"
);
"In
BackendRados::Backend
Rados, failed to m_cluster.init"
);
try
{
try
{
RadosTimeoutLogger
rtl
;
RadosTimeoutLogger
rtl
;
cta
::
exception
::
Errnum
::
throwOnReturnedErrnoOrThrownStdException
([
&
]()
{
return
-
m_cluster
.
conf_read_file
(
NULL
);},
cta
::
exception
::
Errnum
::
throwOnReturnedErrnoOrThrownStdException
([
&
]()
{
return
-
m_cluster
.
conf_read_file
(
NULL
);},
"In
ObjectStoreRados::ObjectStore
Rados, failed to m_cluster.conf_read_file"
);
"In
BackendRados::Backend
Rados, failed to m_cluster.conf_read_file"
);
rtl
.
logIfNeeded
(
"In BackendRados::BackendRados(): m_cluster.conf_read_file()"
,
"no object"
);
rtl
.
logIfNeeded
(
"In BackendRados::BackendRados(): m_cluster.conf_read_file()"
,
"no object"
);
rtl
.
reset
();
rtl
.
reset
();
cta
::
exception
::
Errnum
::
throwOnReturnedErrnoOrThrownStdException
([
&
](){
return
-
m_cluster
.
conf_parse_env
(
NULL
);},
cta
::
exception
::
Errnum
::
throwOnReturnedErrnoOrThrownStdException
([
&
](){
return
-
m_cluster
.
conf_parse_env
(
NULL
);},
"In
ObjectStoreRados::ObjectStore
Rados, failed to m_cluster.conf_parse_env"
);
"In
BackendRados::Backend
Rados, failed to m_cluster.conf_parse_env"
);
rtl
.
logIfNeeded
(
"In BackendRados::BackendRados(): m_cluster.conf_parse_env()"
,
"no object"
);
rtl
.
logIfNeeded
(
"In BackendRados::BackendRados(): m_cluster.conf_parse_env()"
,
"no object"
);
rtl
.
reset
();
rtl
.
reset
();
cta
::
exception
::
Errnum
::
throwOnReturnedErrnoOrThrownStdException
([
&
]()
{
return
-
m_cluster
.
connect
();},
cta
::
exception
::
Errnum
::
throwOnReturnedErrnoOrThrownStdException
([
&
]()
{
return
-
m_cluster
.
connect
();},
"In
ObjectStoreRados::ObjectStore
Rados, failed to m_cluster.connect"
);
"In
BackendRados::Backend
Rados, failed to m_cluster.connect"
);
rtl
.
logIfNeeded
(
"In BackendRados::BackendRados(): m_cluster.connect()"
,
"no object"
);
rtl
.
logIfNeeded
(
"In BackendRados::BackendRados(): m_cluster.connect()"
,
"no object"
);
// Create the connection pool. One per CPU hardware thread.
// Create the connection pool. One per CPU hardware thread.
for
(
size_t
i
=
0
;
i
<
std
::
thread
::
hardware_concurrency
();
i
++
)
{
for
(
size_t
i
=
0
;
i
<
std
::
thread
::
hardware_concurrency
();
i
++
)
{
...
@@ -108,7 +108,7 @@ m_user(userId), m_pool(pool), m_namespace(radosNameSpace), m_cluster(), m_radosC
...
@@ -108,7 +108,7 @@ m_user(userId), m_pool(pool), m_namespace(radosNameSpace), m_cluster(), m_radosC
lc
.
log
(
log
::
DEBUG
,
"BackendRados::BackendRados() about to create a new context"
);
lc
.
log
(
log
::
DEBUG
,
"BackendRados::BackendRados() about to create a new context"
);
rtl
.
reset
();
rtl
.
reset
();
cta
::
exception
::
Errnum
::
throwOnReturnedErrnoOrThrownStdException
([
&
]()
{
return
-
m_cluster
.
ioctx_create
(
pool
.
c_str
(),
m_radosCtxPool
.
back
());},
cta
::
exception
::
Errnum
::
throwOnReturnedErrnoOrThrownStdException
([
&
]()
{
return
-
m_cluster
.
ioctx_create
(
pool
.
c_str
(),
m_radosCtxPool
.
back
());},
"In
ObjectStoreRados::ObjectStore
Rados, failed to m_cluster.ioctx_create"
);
"In
BackendRados::Backend
Rados, failed to m_cluster.ioctx_create"
);
rtl
.
logIfNeeded
(
"In BackendRados::BackendRados(): m_cluster.ioctx_create()"
,
"no object"
);
rtl
.
logIfNeeded
(
"In BackendRados::BackendRados(): m_cluster.ioctx_create()"
,
"no object"
);
lc
.
log
(
log
::
DEBUG
,
"BackendRados::BackendRados() context created. About to set namespace."
);
lc
.
log
(
log
::
DEBUG
,
"BackendRados::BackendRados() context created. About to set namespace."
);
librados
::
bufferlist
bl
;
librados
::
bufferlist
bl
;
...
@@ -124,7 +124,7 @@ lc.log(log::DEBUG, "BackendRados::BackendRados() namespace set. About to test ac
...
@@ -124,7 +124,7 @@ lc.log(log::DEBUG, "BackendRados::BackendRados() namespace set. About to test ac
auto
rc
=
m_radosCtxPool
.
back
().
read
(
"TestObjectThatDoesNotNeedToExist"
,
bl
,
1
,
0
);
auto
rc
=
m_radosCtxPool
.
back
().
read
(
"TestObjectThatDoesNotNeedToExist"
,
bl
,
1
,
0
);
rtl
.
logIfNeeded
(
"In BackendRados::BackendRados(): m_radosCtxPool.back().read()"
,
"TestObjectThatDoesNotNeedToExist"
);
rtl
.
logIfNeeded
(
"In BackendRados::BackendRados(): m_radosCtxPool.back().read()"
,
"TestObjectThatDoesNotNeedToExist"
);
return
(
-
rc
==
ENOENT
?
0
:-
rc
);},
return
(
-
rc
==
ENOENT
?
0
:-
rc
);},
"In
ObjectStoreRados::ObjectStore
Rados, failed to m_radosCtxPool.back().read(), and error is not ENOENT as expected"
);
"In
BackendRados::Backend
Rados, failed to m_radosCtxPool.back().read(), and error is not ENOENT as expected"
);
}
}
{
{
log
::
ScopedParamContainer
params
(
lc
);
log
::
ScopedParamContainer
params
(
lc
);
...
@@ -196,7 +196,7 @@ void BackendRados::create(std::string name, std::string content) {
...
@@ -196,7 +196,7 @@ void BackendRados::create(std::string name, std::string content) {
int
ret
=
-
getRadosCtx
().
operate
(
name
,
&
wop
);
int
ret
=
-
getRadosCtx
().
operate
(
name
,
&
wop
);
return
ret
;
return
ret
;
},
},
std
::
string
(
"In
ObjectStore
Rados::create, failed to create exclusively or write: "
)
std
::
string
(
"In
Backend
Rados::create, failed to create exclusively or write: "
)
+
name
);
+
name
);
}
catch
(
cta
::
exception
::
Errnum
&
en
)
{
}
catch
(
cta
::
exception
::
Errnum
&
en
)
{
if
(
en
.
errorNumber
()
==
EEXIST
)
{
if
(
en
.
errorNumber
()
==
EEXIST
)
{
...
@@ -222,7 +222,7 @@ void BackendRados::atomicOverwrite(std::string name, std::string content) {
...
@@ -222,7 +222,7 @@ void BackendRados::atomicOverwrite(std::string name, std::string content) {
wop
.
write_full
(
bl
);
wop
.
write_full
(
bl
);
RadosTimeoutLogger
rtl
;
RadosTimeoutLogger
rtl
;
cta
::
exception
::
Errnum
::
throwOnReturnedErrnoOrThrownStdException
([
&
]()
{
return
-
getRadosCtx
().
operate
(
name
,
&
wop
);
},
cta
::
exception
::
Errnum
::
throwOnReturnedErrnoOrThrownStdException
([
&
]()
{
return
-
getRadosCtx
().
operate
(
name
,
&
wop
);
},
std
::
string
(
"In
ObjectStore
Rados::atomicOverwrite, failed to assert existence or write: "
)
std
::
string
(
"In
Backend
Rados::atomicOverwrite, failed to assert existence or write: "
)
+
name
);
+
name
);
rtl
.
logIfNeeded
(
"In BackendRados::atomicOverwrite(): m_radosCtx.operate(assert_exists+write_full)"
,
name
);
rtl
.
logIfNeeded
(
"In BackendRados::atomicOverwrite(): m_radosCtx.operate(assert_exists+write_full)"
,
name
);
}
}
...
@@ -236,7 +236,7 @@ std::string BackendRados::read(std::string name) {
...
@@ -236,7 +236,7 @@ std::string BackendRados::read(std::string name) {
auto
rc
=
getRadosCtx
().
read
(
name
,
bl
,
std
::
numeric_limits
<
int32_t
>::
max
(),
0
);
auto
rc
=
getRadosCtx
().
read
(
name
,
bl
,
std
::
numeric_limits
<
int32_t
>::
max
(),
0
);
return
rc
<
0
?
rc
:
0
;
return
rc
<
0
?
rc
:
0
;
},
},
std
::
string
(
"In
ObjectStore
Rados::read, failed to read: "
)
std
::
string
(
"In
Backend
Rados::read, failed to read: "
)
+
name
);
+
name
);
}
catch
(
cta
::
exception
::
Errnum
&
e
)
{
}
catch
(
cta
::
exception
::
Errnum
&
e
)
{
// If the object is not present, throw a more detailed exception.
// If the object is not present, throw a more detailed exception.
...
@@ -441,7 +441,7 @@ std::string BackendRados::createUniqueClientId() {
...
@@ -441,7 +441,7 @@ std::string BackendRados::createUniqueClientId() {
// Build a unique client name: host:thread
// Build a unique client name: host:thread
char
buff
[
200
];
char
buff
[
200
];
cta
::
exception
::
Errnum
::
throwOnMinusOne
(
gethostname
(
buff
,
sizeof
(
buff
)),
cta
::
exception
::
Errnum
::
throwOnMinusOne
(
gethostname
(
buff
,
sizeof
(
buff
)),
"In
ObjectStore
Rados::lockExclusive: failed to gethostname"
);
"In
Backend
Rados::lockExclusive: failed to gethostname"
);
pid_t
tid
=
syscall
(
SYS_gettid
);
pid_t
tid
=
syscall
(
SYS_gettid
);
std
::
stringstream
client
;
std
::
stringstream
client
;
client
<<
buff
<<
":"
<<
tid
;
client
<<
buff
<<
":"
<<
tid
;
...
@@ -533,7 +533,7 @@ void BackendRados::lockNotify(std::string name, uint64_t timeout_us, LockType lo
...
@@ -533,7 +533,7 @@ void BackendRados::lockNotify(std::string name, uint64_t timeout_us, LockType lo
}
}
}
}
cta
::
exception
::
Errnum
::
throwOnReturnedErrno
(
-
rc
,
cta
::
exception
::
Errnum
::
throwOnReturnedErrno
(
-
rc
,
std
::
string
(
"In
ObjectStore
Rados::lock(), failed to librados::IoCtx::"
)
+
std
::
string
(
"In
Backend
Rados::lock(), failed to librados::IoCtx::"
)
+
(
lockType
==
LockType
::
Shared
?
"lock_shared: "
:
"lock_exclusive: "
)
+
(
lockType
==
LockType
::
Shared
?
"lock_shared: "
:
"lock_exclusive: "
)
+
name
+
"/"
+
"lock"
+
"/"
+
clientId
+
"//"
);
name
+
"/"
+
"lock"
+
"/"
+
clientId
+
"//"
);
// We could have created an empty object by trying to lock it. We can find this out: if the object is
// We could have created an empty object by trying to lock it. We can find this out: if the object is
...
@@ -542,12 +542,12 @@ void BackendRados::lockNotify(std::string name, uint64_t timeout_us, LockType lo
...
@@ -542,12 +542,12 @@ void BackendRados::lockNotify(std::string name, uint64_t timeout_us, LockType lo
uint64_t
size
;
uint64_t
size
;
time_t
date
;
time_t
date
;
cta
::
exception
::
Errnum
::
throwOnReturnedErrnoOrThrownStdException
([
&
]()
{
return
-
radosCtx
.
stat
(
name
,
&
size
,
&
date
);
},
cta
::
exception
::
Errnum
::
throwOnReturnedErrnoOrThrownStdException
([
&
]()
{
return
-
radosCtx
.
stat
(
name
,
&
size
,
&
date
);
},
std
::
string
(
"In
ObjectStore
Rados::lock, failed to librados::IoCtx::stat: "
)
+
std
::
string
(
"In
Backend
Rados::lock, failed to librados::IoCtx::stat: "
)
+
name
+
"/"
+
"lock"
+
"/"
+
clientId
+
"//"
);
name
+
"/"
+
"lock"
+
"/"
+
clientId
+
"//"
);
if
(
!
size
)
{
if
(
!
size
)
{
// The object has a zero size: we probably created it by attempting the locking.
// The object has a zero size: we probably created it by attempting the locking.
cta
::
exception
::
Errnum
::
throwOnReturnedErrnoOrThrownStdException
([
&
]()
{
return
-
radosCtx
.
remove
(
name
);},
cta
::
exception
::
Errnum
::
throwOnReturnedErrnoOrThrownStdException
([
&
]()
{
return
-
radosCtx
.
remove
(
name
);},
std
::
string
(
"In
ObjectStore
Rados::lock, failed to librados::IoCtx::remove: "
)
+
std
::
string
(
"In
Backend
Rados::lock, failed to librados::IoCtx::remove: "
)
+
name
+
"//"
);
name
+
"//"
);
throw
Backend
::
NoSuchObject
(
std
::
string
(
"In BackendRados::lockWatch(): "
throw
Backend
::
NoSuchObject
(
std
::
string
(
"In BackendRados::lockWatch(): "
"trying to lock a non-existing object: "
)
+
name
);
"trying to lock a non-existing object: "
)
+
name
);
...
@@ -734,7 +734,7 @@ void BackendRados::lockBackoff(std::string name, uint64_t timeout_us, LockType l
...
@@ -734,7 +734,7 @@ void BackendRados::lockBackoff(std::string name, uint64_t timeout_us, LockType l
t
.
reset
();
t
.
reset
();
}
}
cta
::
exception
::
Errnum
::
throwOnReturnedErrno
(
-
rc
,
cta
::
exception
::
Errnum
::
throwOnReturnedErrno
(
-
rc
,
std
::
string
(
"In
ObjectStore
Rados::lock(), failed to librados::IoCtx::"
)
+
std
::
string
(
"In
Backend
Rados::lock(), failed to librados::IoCtx::"
)
+
(
lockType
==
LockType
::
Shared
?
"lock_shared: "
:
"lock_exclusive: "
)
+
(
lockType
==
LockType
::
Shared
?
"lock_shared: "
:
"lock_exclusive: "
)
+
name
+
"/"
+
"lock"
+
"/"
+
clientId
+
"//"
);
name
+
"/"
+
"lock"
+
"/"
+
clientId
+
"//"
);
// We could have created an empty object by trying to lock it. We can find this out: if the object is
// We could have created an empty object by trying to lock it. We can find this out: if the object is
...
@@ -743,12 +743,12 @@ void BackendRados::lockBackoff(std::string name, uint64_t timeout_us, LockType l
...
@@ -743,12 +743,12 @@ void BackendRados::lockBackoff(std::string name, uint64_t timeout_us, LockType l
uint64_t
size
;
uint64_t
size
;
time_t
date
;
time_t
date
;
cta
::
exception
::
Errnum
::
throwOnReturnedErrnoOrThrownStdException
([
&
]()
{
return
-
radosCtx
.
stat
(
name
,
&
size
,
&
date
);
},
cta
::
exception
::
Errnum
::
throwOnReturnedErrnoOrThrownStdException
([
&
]()
{
return
-
radosCtx
.
stat
(
name
,
&
size
,
&
date
);
},
std
::
string
(
"In
ObjectStore
Rados::lockBackoff, failed to librados::IoCtx::stat: "
)
+
std
::
string
(
"In
Backend
Rados::lockBackoff, failed to librados::IoCtx::stat: "
)
+
name
+
"/"
+
"lock"
+
"/"
+
clientId
+
"//"
);
name
+
"/"
+
"lock"
+
"/"
+
clientId
+
"//"
);
if
(
!
size
)
{
if
(
!
size
)
{
// The object has a zero size: we probably created it by attempting the locking.
// The object has a zero size: we probably created it by attempting the locking.
cta
::
exception
::
Errnum
::
throwOnReturnedErrnoOrThrownStdException
([
&
]()
{
return
-
radosCtx
.
remove
(
name
);
},
cta
::
exception
::
Errnum
::
throwOnReturnedErrnoOrThrownStdException
([
&
]()
{
return
-
radosCtx
.
remove
(
name
);
},
std
::
string
(
"In
ObjectStore
Rados::lockBackoff, failed to librados::IoCtx::remove: "
)
+
std
::
string
(
"In
Backend
Rados::lockBackoff, failed to librados::IoCtx::remove: "
)
+
name
+
"//"
);
name
+
"//"
);
throw
Backend
::
NoSuchObject
(
std
::
string
(
"In BackendRados::lockBackoff(): "
throw
Backend
::
NoSuchObject
(
std
::
string
(
"In BackendRados::lockBackoff(): "
"trying to lock a non-existing object: "
)
+
name
);
"trying to lock a non-existing object: "
)
+
name
);
...
...
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