Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
physical
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpha
physical
Commits
452a3aeb
Commit
452a3aeb
authored
Mar 11, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify topic transfer
parent
65820e85
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
table_scan.py
libs/table_scan.py
+11
-6
No files found.
libs/table_scan.py
View file @
452a3aeb
...
...
@@ -6,6 +6,7 @@ import six
import
random
from
django.db
import
models
import
logging
import
traceback
class
ITableChunk
(
object
):
...
...
@@ -167,18 +168,22 @@ class TableSlicer(object):
for
index
in
index_list
]
logging
.
info
(
"duan add,queryset count:
%
d"
%
count
)
self
.
_model
=
queryset
.
model
self
.
_query
=
queryset
.
query
self
.
_sep_list
=
[
None
]
+
sep_list
+
[
None
]
def
chunks
(
self
):
reversed_sep_list
=
list
(
reversed
(
self
.
_sep_list
))
logging
.
info
(
"duan add,reversed_sep_list:
%
d"
%
(
len
(
self
.
_sep_list
)
-
1
))
for
i
in
range
(
len
(
self
.
_sep_list
)
-
1
):
pk_start
=
reversed_sep_list
[
i
+
1
]
pk_stop
=
reversed_sep_list
[
i
]
yield
TableSlicerChunk
(
model
=
self
.
_model
,
query
=
self
.
_query
,
pk_start
=
pk_start
,
pk_stop
=
pk_stop
)
try
:
reversed_sep_list
=
list
(
reversed
(
self
.
_sep_list
))
logging
.
info
(
"duan add,reversed_sep_list:
%
d"
%
(
len
(
self
.
_sep_list
)
-
1
))
for
i
in
range
(
len
(
self
.
_sep_list
)
-
1
):
pk_start
=
reversed_sep_list
[
i
+
1
]
pk_stop
=
reversed_sep_list
[
i
]
yield
TableSlicerChunk
(
model
=
self
.
_model
,
query
=
self
.
_query
,
pk_start
=
pk_start
,
pk_stop
=
pk_stop
)
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
class
TableStreamingSlicer
(
object
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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