Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tarantool
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
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
core
tarantool
Commits
60ed7e55
Commit
60ed7e55
authored
11 years ago
by
Eugine Blikh
Committed by
Konstantin Osipov
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add snapshot 'Player'
Little refactoring +xlog, +snap, snapshot->snap
parent
cf6eb0f8
No related branches found
Branches containing commit
Tags
1.6.0
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
client/tarantool/tc_store.c
+45
-7
45 additions, 7 deletions
client/tarantool/tc_store.c
with
45 additions
and
7 deletions
client/tarantool/tc_store.c
+
45
−
7
View file @
60ed7e55
...
...
@@ -121,7 +121,7 @@ static int tc_store_check_skip(struct tnt_iter *i, struct tnt_request *r) {
return
0
;
}
static
int
tc_store_printer
(
struct
tnt_iter
*
i
)
{
static
int
tc_store_
xlog_
printer
(
struct
tnt_iter
*
i
)
{
struct
tnt_request
*
r
=
TNT_IREQUEST_PTR
(
i
);
if
(
tc_store_check_skip
(
i
,
r
))
return
0
;
...
...
@@ -131,7 +131,7 @@ static int tc_store_printer(struct tnt_iter *i) {
return
0
;
}
static
int
tc_s
napshot
_printer
(
struct
tnt_iter
*
i
)
{
static
int
tc_s
tore_snap
_printer
(
struct
tnt_iter
*
i
)
{
struct
tnt_tuple
*
tu
=
TNT_ISTORAGE_TUPLE
(
i
);
struct
tnt_stream_snapshot
*
ss
=
TNT_SSNAPSHOT_CAST
(
TNT_ISTORAGE_STREAM
(
i
));
...
...
@@ -163,7 +163,7 @@ static int tc_store_foreach_xlog(tc_iter_t cb) {
return
rc
;
}
static
int
tc_store_foreach_snap
shot
(
tc_iter_t
cb
)
{
static
int
tc_store_foreach_snap
(
tc_iter_t
cb
)
{
struct
tnt_stream
s
;
tnt_snapshot
(
&
s
);
if
(
tnt_snapshot_open
(
&
s
,
(
char
*
)
tc
.
opt
.
file
)
==
-
1
)
{
...
...
@@ -195,10 +195,10 @@ int tc_store_cat(void)
switch
(
type
)
{
case
TNT_LOG_SNAPSHOT
:
rc
=
tc_store_foreach_snap
shot
(
tc_s
napshot
_printer
);
rc
=
tc_store_foreach_snap
(
tc_s
tore_snap
_printer
);
break
;
case
TNT_LOG_XLOG
:
rc
=
tc_store_foreach_xlog
(
tc_store_printer
);
rc
=
tc_store_foreach_xlog
(
tc_store_
xlog_
printer
);
break
;
case
TNT_LOG_NONE
:
rc
=
1
;
...
...
@@ -212,8 +212,29 @@ int tc_store_cat(void)
}
return
rc
;
}
static
int
tc_store_snap_resender
(
struct
tnt_iter
*
i
)
{
struct
tnt_tuple
*
tu
=
TNT_ISTORAGE_TUPLE
(
i
);
struct
tnt_stream_snapshot
*
ss
=
TNT_SSNAPSHOT_CAST
(
TNT_ISTORAGE_STREAM
(
i
));
if
(
tc
.
opt
.
space_set
)
{
if
(
ss
->
log
.
current
.
row_snap
.
space
!=
tc
.
opt
.
space
)
return
0
;
}
if
(
tnt_insert
(
tc
.
net
,
ss
->
log
.
current
.
row_snap
.
space
,
TNT_FLAG_ADD
,
tu
)
==
-
1
)
return
tc_store_error
(
"failed to write request"
);
char
*
e
=
NULL
;
if
(
tc_query_foreach
(
NULL
,
NULL
,
&
e
)
==
-
1
)
{
tc_store_error
(
"%s"
,
e
);
free
(
e
);
return
-
1
;
}
return
0
;
}
static
int
tc_store_resender
(
struct
tnt_iter
*
i
)
{
static
int
tc_store_xlog_resender
(
struct
tnt_iter
*
i
)
{
struct
tnt_request
*
r
=
TNT_IREQUEST_PTR
(
i
);
if
(
tc_store_check_skip
(
i
,
r
))
return
0
;
...
...
@@ -230,7 +251,24 @@ static int tc_store_resender(struct tnt_iter *i) {
int
tc_store_play
(
void
)
{
return
tc_store_foreach_xlog
(
tc_store_resender
);
enum
tnt_log_type
type
=
tnt_log_guess
((
char
*
)
tc
.
opt
.
file
);
if
(
type
==
TNT_LOG_NONE
)
return
1
;
int
rc
;
switch
(
type
)
{
case
TNT_LOG_SNAPSHOT
:
rc
=
tc_store_foreach_snap
(
tc_store_snap_resender
);
break
;
case
TNT_LOG_XLOG
:
rc
=
tc_store_foreach_xlog
(
tc_store_xlog_resender
);
break
;
case
TNT_LOG_NONE
:
rc
=
1
;
break
;
default:
return
-
1
;
}
return
rc
;
}
static
int
tc_store_printer_from_rpl
(
struct
tnt_iter
*
i
)
{
...
...
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