You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by pa...@apache.org on 2018/04/04 14:10:16 UTC
[trafficserver] branch master updated: modify cache tool commands
and update the doc
This is an automated email from the ASF dual-hosted git repository.
paziz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new e4c7472 modify cache tool commands and update the doc
e4c7472 is described below
commit e4c74720a62874d851518fe7f46047a71d097e43
Author: Persia Aziz <pe...@yahoo-inc.com>
AuthorDate: Tue Apr 3 17:27:13 2018 -0500
modify cache tool commands and update the doc
---
cmd/traffic_cache_tool/CacheTool.cc | 13 ++++---
.../command-line/traffic_cache_tool.en.rst | 44 +++++++++++++++++++++-
2 files changed, 51 insertions(+), 6 deletions(-)
diff --git a/cmd/traffic_cache_tool/CacheTool.cc b/cmd/traffic_cache_tool/CacheTool.cc
index c7da121..c620b64 100644
--- a/cmd/traffic_cache_tool/CacheTool.cc
+++ b/cmd/traffic_cache_tool/CacheTool.cc
@@ -263,7 +263,7 @@ Stripe::Chunk::clear()
Stripe::Stripe(Span *span, Bytes start, CacheStoreBlocks len) : _span(span), _start(start), _len(len)
{
- ts::bwprint(hashText, "{} {}:{}", span->_path.path(), _start, _len.count());
+ ts::bwprint(hashText, "{} {}:{}", span->_path.path(), _start.count(), _len.count());
printf("hash id of stripe is hash of %.*s\n", static_cast<int>(hashText.size()), hashText.data());
}
@@ -2187,7 +2187,7 @@ Simulate_Span_Allocation(int argc, char *argv[])
}
Errata
-Clear_Spans(int argc, char *argv[])
+Clear_Spans()
{
Errata zret;
Cache cache;
@@ -2420,7 +2420,10 @@ main(int argc, char *argv[])
Commands.add("list", "List elements of the cache", []() { return List_Stripes(Cache::SpanDumpDepth::SPAN); })
.subCommand(std::string("stripes"), std::string("List the stripes"),
[]() { return List_Stripes(Cache::SpanDumpDepth::STRIPE); });
- Commands.add(std::string("clear"), std::string("Clear spans"), &Clear_Spans);
+ Commands.add(std::string("clear"), std::string("Clear spans"), []() { return Clear_Spans(); })
+ .subCommand(std::string("span"), std::string("clear an specific span"),
+ [&](int, char *argv[]) { return Clear_Span(inputFile); });
+
auto &c = Commands.add(std::string("dir_check"), std::string("cache check"));
c.subCommand(std::string("full"), std::string("Full report of the cache storage"), &dir_check);
c.subCommand(std::string("freelist"), std::string("check the freelist for loop"),
@@ -2430,8 +2433,8 @@ main(int argc, char *argv[])
Commands.add(std::string("volumes"), std::string("Volumes"), &Simulate_Span_Allocation);
Commands.add(std::string("alloc"), std::string("Storage allocation"))
.subCommand(std::string("free"), std::string("Allocate storage on free (empty) spans"), &Cmd_Allocate_Empty_Spans);
- Commands.add(std::string("find"), std::string("Find Stripe Assignment"))
- .subCommand(std::string("url"), std::string("URL"), [&](int, char *argv[]) { return Find_Stripe(input_url_file); });
+ Commands.add(std::string("find"), std::string("Find Stripe Assignment"),
+ [&](int, char *argv[]) { return Find_Stripe(input_url_file); });
Commands.add(std::string("clearspan"), std::string("clear specific span"))
.subCommand(std::string("span"), std::string("device path"), [&](int, char *argv[]) { return Clear_Span(inputFile); });
Commands.add(std::string("retrieve"), std::string(" retrieve the response of the given list of URLs"),
diff --git a/doc/appendices/command-line/traffic_cache_tool.en.rst b/doc/appendices/command-line/traffic_cache_tool.en.rst
index c094c73..48f11ef 100644
--- a/doc/appendices/command-line/traffic_cache_tool.en.rst
+++ b/doc/appendices/command-line/traffic_cache_tool.en.rst
@@ -68,6 +68,10 @@ be abbreviated to any unique initial substring (e.g. "--sp" for "--span").
Specific the average object size in bytes. This is used in various computations. It is identical
to :ts:cv:`proxy.config.cache.min_average_object_size`.
+.. option:: --input
+
+ Specify the input file or disk.
+
===========
Commands
===========
@@ -80,7 +84,10 @@ Commands
Print internal stripe metadata.
``clear``
- Clear spans by writing updated span headers.
+ Clear all the spans by writing updated span headers.
+
+ ``span``
+ Clears an specific span and it's stripes. The span to be cleared is specified via ``--device``
``dir_check``
Perform diagnostics on the stripe directories.
@@ -103,7 +110,14 @@ Commands
``free``
Allocate only free (unused) storage to volumes, updating span and stripe headers as needed.
+``init``
+ Initializes an uninitialized span and creates stripes on that span according to the volume and storage configuration
+ The span to be initialized can be passed via ``--input``
+``find``
+ Determines the stripe in disk cache where the content corresponding to the provided URL may be cached.
+ This command takes an input file which lists all the urls for which the stripe assignment needs to be determined.
+
========
Examples
========
@@ -119,6 +133,34 @@ Allocate unused storage space.::
--volumes=/usr/local/etc/trafficserver/volume.config \
alloc free
+Clear all spans.::
+
+ traffic_cache_tool \
+ --spans=/usr/local/etc/trafficserver/storage.config \
+ --volumes=/usr/local/etc/trafficserver/volume.config \
+ clear
+
+Clear a single span.::
+
+ traffic_cache_tool \
+ --span /opt/etc/trafficserver/storage.config \
+ --volume /opt/etc/trafficserver/volume.config \
+ clear span --device "/dev/sdb3" --write
+
+Initialize a new span.::
+
+ traffic_cache_tool \
+ --span /opt/etc/trafficserver/storage.config \
+ --volume /opt/etc/trafficserver/volume.config \
+ init --input "/dev/sdb3" --write
+
+Find Stripe Assignment.::
+
+ traffic_cache_tool \
+ --span /opt/etc/trafficserver/storage.config \
+ --volume /opt/etc/trafficserver/volume.config \
+ init --input "/home/user/urls.txt"
+
========
See also
========
--
To stop receiving notification emails like this one, please contact
paziz@apache.org.