Tag Archive for 'tutorial'

Page 2 of 4

Switch your Subversion Working Copy

Apache Subversion’s ‘svn switch’ command allows users to update a working copy to a different URL. This is useful when you need to update your working copy to mirror a newly-created branch.

Although it’s possible to achieve the same effect by performing a fresh checkout, the ‘svn switch’ command is a quicker alternative. It saves you the overhead of running ‘svn checkout,’ and applies the changes required to bring your working copy inline with the new location, making it a very efficient command. It also preserves any changes you’ve made in the working copy.

To perform a switch, run ‘svn switch’ followed by the URL path you wish to mirror. Apache Subversion will then go ahead and update your working copy.

svn switch

Additional Options

There are some additional options you can apply to fine-tune the ‘svn switch’ command:

  • Ignore Ancestry

If Subversion cannot find a common ancestor for the URL and your working copy, it will block the operation and display an error message.

svn switch 2

It is possible to force Subversion to switch to this URL anyway, by adding the –ignore-ancestry option.

svn switch (target-URL) –ignore-ancestry

svn switch 3

  • Target a Particular Revision


You can also specify a particular revision of the URL you’re switching to. Note that Subversion defaults to the HEAD revision, if no alternate revision is specified:

svn switch -r(revision-number) (target-URL)

svn switch 4

Want more free Subversion training? We offer plenty of webinar replays available on-demand, or you can sign up for our upcoming webinars.

Subversion’s SVN Annotate Command

Apache Subversion’s ‘svn annotate’ command allows users to view a line-by-line breakdown of all the changes that have been applied to a human-readable file in your working copy. This information is printed alongside details on:

  • The person responsible for each change
  • The revision number where each change occurred

Note that this line-by-line attribution is based on the file as it currently appears within the working copy.

To run ‘svn annotate’ on a file, enter:

svn annotate (working-copy-location)/file-being-examined

In this example, we’re examining all the changes for the ‘Changelog’ file, which is located inside the trunk of our working copy.

svn annotate

If you need a more comprehensive printout, the -verbose (-v) switch adds the full datestamp to each line.

svn annotate 2

The –force Switch

The ‘svn annotate’ command uses Multipurpose Internet Mail Extensions (MIME) types to automatically detect whether a file is human-readable. By default, ‘svn annotate’ will block any file that’s non human-readable. If you attempt to perform an ‘svn annotate’ on a file that Subversion judges not to be readable, you’ll get an error message.

svn annotate 3

If you want to go ahead regardless, you can add the –force switch. Of course, this may result in a screen full of strange symbols if the file truly is non human-readable!

svn annotate 4

Not yet started with SmartSVN, the easy-to-use graphical client from Subversion? Get your free 30 day trial at www.smartsvn.com/download

Checking Your Changes with SVN

Before committing work to the central repository, you may want to review the changes you’ve made. This can be achieved by running Apache Subversion’s ‘svn status’ command at the top of your working copy, which will print out a list of all your local changes:

svn status (working-copy-path)

svn status

The characters in the first column represent the state of the file/directory listed. The different characters are:

  • ? – item is not under version control.
  • ! – item is missing.
  • A – item is scheduled to be added to the repository.
  • C – item is in a state of conflict.
  • D – item is scheduled to be deleted in the repository.
  • M – item contents have been modified.

Alternatively, if you need information about all the files in your working copy, regardless of whether they have been modified, you can add Subversion’s –verbose (–v) switch to ‘svn status:’

svn status –v (working-copy-path)

svn status 2

Need additional support with your Subversion installation? We provide a range of professional support services for SVN users, including indemnification coverage, guaranteed response times, system health checks and more.

Subversion Tip of the Week

SVN Blame

In certain situations, you may need more information about how a file changed in a particular Apache Subversion revision and crucially, who was responsible for that change. This is achieved by running the ‘svn blame’ command. This command prints each modified line of the specified file, alongside the revision number and the username of the person responsible for that change.

To run the ‘svn blame’ command, enter:

svn blame (repository-URL)/file

svn blame

However, sometimes the change may simply be an arbitrary whitespace or other formatting change. If you suspect this could be the case, the extensions switch (-x) can be used in conjunction with several other switches to filter out arbitrary changes:

  • –ignore-all-space (-w) – ignores all whitespace.
  • –ignore-space-change (-b) – ignores all changes in the amount of whitespace.
  • –ignore-eol-style – ignores changes in end-of-line-style.

In this example, we’re running ‘svn blame’ on the same file, but this time specifying that any EOL changes should be ignored.

svn blame -x –ignore-eol-style (repository-URL)/file

svn blame 2

Looking for an easy-to-use cross platform Subversion client? Claim your free 30 day trial of SmartSVN Professional by visiting: www.smartsvn.com/download

Subversion Tip of the Week

SVN Import

There are two main options when you need to add new file(s) to your Apache Subversion project: the ‘SVN Add’ command and ‘SVN Import.’ The advantage of performing an ‘SVN Import’ is that:

  • ‘SVN Import’ communicates directly with the repository, so no working copy or checkout is required.
  • Your files are immediately committed to the repository, and are therefore available to the rest of the team.
  • Intermediate directories that don’t already exist in the repository are automatically created without the need for additional switches.

‘SVN Import’ is typically used when you have a local file tree that’s being added to your Subversion project. Run the following to add a file/file tree to your repository:

svn import -m “log message” (local file/file tree path) (repository-URL)

In this example, we’re adding the contents of the “Release2” folder to the repository, in an existing ‘branches’ directory.

svn import 1

As already mentioned, intermediate directories do not need to exist prior to running the ‘SVN Import’ command. In this example, we’re again importing the contents of ‘Release2,’ but this time we’re simultaneously creating a ‘Release2’ directory to contain the files.

svn import create new folder

If you check the repository, you’ll see a new ‘Release2’ directory has been created. The contents of your ‘Release2’ file tree are located inside.

ubersvn import

Want more advice on your Apache Subversion installation? We have a full series of SVN refcards for free download, covering hot topics such as branching and merging, and best practices. You can find out more at www.wandisco.com/svnref

Adding and Deleting Files from the Command Line

When working with files under Apache Subversion’s version control, eventually you will need to start adding and removing files from your project. This week’s tip explains how to add a file to a project at the working copy level or, alternatively, commit it straight to the central repository. It will also highlight how to delete a file, either by scheduling it for deletion via the working copy or deleting it straight from the central repository.

Adding Files

Files can be added to a project via the working copy. After you’ve added the file to your working copy, it’ll be sent to the central repository and shared with the rest of your team the next time you perform an ‘svn commit.’

To add a file to your working copy (and schedule it for addition the next time you perform a commit) run:

svn add (working-copy-location)/file-to-be-added

In this example we’re adding a file called ‘executable’ to the trunk directory of the ‘NewRepo’ working copy.

Subversion 1

You’ll need to perform a commit to send this item to the repository and share it with the rest of your team.

Subversion 2

Deleting Files 

Once you start adding files to your working copy, sooner or later you’ll need to remove files. When files are deleted in the working copy, they’re scheduled for deletion in the repository the next time you perform a commit, in exactly the same way as the ‘svn add’ command.

Schedule files for deletion in the working copy by running:

svn delete (working-copy-location)/file-to-be-deleted

In this example, we’re scheduling ‘executable.png’ for deletion.

Subversion 3

Alternatively, you can delete files from the repository immediately. Note, this operation creates a new revision and therefore requires a log message.

svn delete -m “log message” (repository-URL)/file-to-be-deleted

Subversion 4

Looking for an easy-to-use cross platform Subversion client? Claim your free 30 day trial of SmartSVN Professional by visiting: www.smartsvn.com/download

Fetching Previous Revisions in Subversion

One of the fundamental features of Apache Subversion is that it remembers every change committed to the central repository, allowing users to easily recover previous versions of their project.

There are several methods available to users who wish to roll back to an earlier revision:

1) Perform a Checkout

By default, Subversion checks out the head revision, but you can instruct it to checkout a previous revision by adding a revision number to your command:

svn checkout -r(revision-number) (repository-URL)

In this example, we’re creating a working copy from the repository data in revision 5.

checking out revision 5

2) ‘Update’ to Previous Revision

If you already have a working copy, you can ‘update’ it to a previous revision by using ‘svn update’ and specifying the revision number:

svn update -r(revision-number) (working-copy-location)

In this example, we’re updating the ‘Project’ working copy to revision 5.

svn update to past revision

3) Perform a Reverse Merge

Alternatively, you can perform a reverse merge on your working copy. Usually, a reverse merge is followed by an svn commit, which sends the previous revision to the repository. This effectively rolls the project back to an earlier version and is useful if recent commit(s) contain errors or features you need to remove.

To perform a reverse merge, run:

svn merge -r(revision-to-be-merged):(target-revision) (working-copy-URL)

svn reverse merge

Looking for an easy-to-use cross platform Subversion client? Claim your free 30 day trial of SmartSVN Professional by visiting: www.smartsvn.com/download

Subversion Tip of the Week

Getting Help With Your Subversion Working Copy

When it comes to getting some extra help with your Apache Subversion installation, you will find plenty of documentation online and even a dedicated forum where SVN users can post their questions and answer others. However, Subversion also comes with some handy built-in commands that can show you specific information about your working copy, files, directories, and all of Subversion’s subcommands and switches. This post explains how to access all of this information from the command line.

1) SVN Help

One of the most useful features of command line Subversion is the instant access to its built-in documentation through the ‘svn help’ command. To review all of the details about a particular subcommand, run:

svn help (subcommand)

In the example below, we’ve requested information on the ‘unlock’ subcommand. The printout includes all the additional switches that can be used in conjunction with ‘svn unlock.’

svn help unlock

Alternatively, if you need to see a list of all the available subcommands, simply run ‘svn help.’

svn help

2) SVN Info

If you need more information about the paths in a particular working copy, run the ‘svn info’ command. This will display:

  • Path
  • Repository URL
  • Repository Root
  • Repository UUID
  • Current revision number
  • Node Kind
  • Schedule
  • Information on the last change that occurred (author, revision number, date)

svn info

3) SVN Status

This command prints the status of your files and directories in your local working copy:

svn status (working-copy-path)

svn status

Want more advice on your Apache Subversion installation? We have a full series of SVN refcards for free download, covering hot topics such as branching and merging, and best practices. You can find out more at www.wandisco.com/svnref

 

Running the SLive Test on WANdisco Distro

The SLive test is a stress test designed to simulate distributed operations and load on the NameNode by utilizing the MapReduce paradigm. It was designed by Konstantin Shvachko and introduced into the Apache Hadoop project in 2010 by him and others. It is now one of the many stress tests we ran here at WANdisco in testing our distribution, WANdisco Distro (WDD).

You can read the original paper about how this test works here:
https://issues.apache.org/jira/secure/attachment/12448004/SLiveTest.pdf
You can view the associated Apache JIRA for the introduction of this test here:
https://issues.apache.org/jira/browse/HDFS-708

This blog will provide a short tutorial on how you can run the SLive test on your own cluster of Hadoop 2 and YARN / MapReduce. Before we begin, please make sure you are logged in as the ‘hdfs’ user:

su – hdfs

The first order of business is to become familiar with the parameters supported by the stress test.

The percentage of operation distribution parameters:
-create <num> -delete <num> -rename <num> -read <num>  -append <num> -ls <num> -mkdir <num>

Stress test property parameters:
-blockSize <min,max> -readSize <min,max> -writeSize <min,max> -files <total>

The first set of parameters controls “how many of this kind of operation do you want?”. For example, if you want to simulate just a create and delete scenario, with no reads or writes, you would run the test with -create 50 -delete 50 (or any other percentages that add up to 100) and set the others in that first set to 0, or just don’t specify them and the test will automatically set them to 0.

The second set of parameters controls properties that extend throughout the entire test. “How many files do you want to make?,” “What is the biggest and smallest that you want each block in the file to be?” They can be ignored for the most part, except for “-blockSize”. Using the default block size, which is 64 megabytes, may cause your run of the SLive test to take longer. In order to make this a speedy tutorial, we will use small block sizes. Please note that block sizes must be in multiples of 512 bytes. We will use 4096 bytes in this tutorial.

There are other parameters available, but they are not necessary in order to provide a basic understanding and run of this stress test. You can refer to the document at the top of this entry if your curiosity of the other parameters is getting the best of you, or you can run:

hadoop org.apache.hadoop.fs.slive.SliveTest –help

The second step is to understand how to run the test. Although it is advised NOT to do this just yet, you can make the following call to instantly run the test with default parameters by executing the following command:

hadoop org.apache.hadoop.fs.slive.SliveTest

However, since we have no initial data within the cluster, you should notice that most, if not all, of the operations in the report are failures. Run the following to initialize the cluster with 10,000 files, all with a tiny 4096 byte block size, in order to achieve a quick run of the SLive test:

hadoop org.apache.hadoop.fs.slive.SliveTest -create 100 -delete 0 -rename 0 -read 0 -append 0 -ls 0 -mkdir 0 -blockSize 4096,4096 -files 10000

On a cluster with 1 NameNode and 3 DataNodes, running this command should take no longer  than about 3 – 4 minutes. If it is taking too long, you can try re-running with a lower “-files” parameter number and/or a smaller “-blockSize” parameter as well.

After you have initialized the cluster with data, you will need to delete the output directory that your previous SLive test run had created:

hadoop fs -rmr /test/slive/slive/output

You will need to do this after every time you have run an SLive test; otherwise your next run attempt will fail, telling you that the output directory for your requested run already exists.

You can now run the default test, which performs an equal distribution of creates, deletes, reads, and other operations across the cluster:

hadoop org.apache.hadoop.fs.slive.SliveTest

Or you can specify the parameters of your own choosing and customize your own load to stress test with! That is the purpose of the test, after all. Enjoy!

Here are the results obtained from our own in-house run of the SLive test for you to compare your own results with. I ran the following command after initialization:

hadoop org.apache.hadoop.fs.slive.SliveTest -blockSize 4096,4096 -files 10000

And I got the following results:

13/02/11 11:00:36 INFO slive.SliveTest: Reporting on job:
13/02/11 11:00:36 INFO slive.SliveTest: Writing report using contents of /test/slive/slive/output
13/02/11 11:00:36 INFO slive.SliveTest: Report results being placed to logging output and to file /home/hdfs/part-0000
13/02/11 11:00:36 INFO slive.ReportWriter: Basic report for operation type AppendOp
13/02/11 11:00:36 INFO slive.ReportWriter: ————-
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “bytes_written” = 4317184
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “failures” = 1
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “files_not_found” = 365
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “milliseconds_taken” = 59813
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “op_count” = 1420
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “successes” = 1054
13/02/11 11:00:36 INFO slive.ReportWriter: Rate for measurement “bytes_written” = 0.067 MB/sec
13/02/11 11:00:36 INFO slive.ReportWriter: Rate for measurement “op_count” = 23.741 operations/sec
13/02/11 11:00:36 INFO slive.ReportWriter: Rate for measurement “successes” = 17.622 successes/sec
13/02/11 11:00:36 INFO slive.ReportWriter: ————-
13/02/11 11:00:36 INFO slive.ReportWriter: Basic report for operation type CreateOp
13/02/11 11:00:36 INFO slive.ReportWriter: ————-
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “bytes_written” = 1490944
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “failures” = 1056
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “milliseconds_taken” = 19029
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “op_count” = 1420
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “successes” = 364
13/02/11 11:00:36 INFO slive.ReportWriter: Rate for measurement “bytes_written” = 0.053 MB/sec
13/02/11 11:00:36 INFO slive.ReportWriter: Rate for measurement “op_count” = 74.623 operations/sec
13/02/11 11:00:36 INFO slive.ReportWriter: Rate for measurement “successes” = 19.129 successes/sec
13/02/11 11:00:36 INFO slive.ReportWriter: ————-
13/02/11 11:00:36 INFO slive.ReportWriter: Basic report for operation type DeleteOp
13/02/11 11:00:36 INFO slive.ReportWriter: ————-
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “failures” = 365
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “milliseconds_taken” = 4905
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “op_count” = 1420
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “successes” = 1055
13/02/11 11:00:36 INFO slive.ReportWriter: Rate for measurement “op_count” = 289.501 operations/sec
13/02/11 11:00:36 INFO slive.ReportWriter: Rate for measurement “successes” = 215.087 successes/sec
13/02/11 11:00:36 INFO slive.ReportWriter: ————-
13/02/11 11:00:36 INFO slive.ReportWriter: Basic report for operation type ListOp
13/02/11 11:00:36 INFO slive.ReportWriter: ————-
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “dir_entries” = 1167
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “files_not_found” = 1145
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “milliseconds_taken” = 536
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “op_count” = 1420
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “successes” = 275
13/02/11 11:00:36 INFO slive.ReportWriter: Rate for measurement “dir_entries” = 2177.239 directory entries/sec
13/02/11 11:00:36 INFO slive.ReportWriter: Rate for measurement “op_count” = 2649.254 operations/sec
13/02/11 11:00:36 INFO slive.ReportWriter: Rate for measurement “successes” = 513.06 successes/sec
13/02/11 11:00:36 INFO slive.ReportWriter: ————-
13/02/11 11:00:36 INFO slive.ReportWriter: Basic report for operation type MkdirOp
13/02/11 11:00:36 INFO slive.ReportWriter: ————-
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “milliseconds_taken” = 5631
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “op_count” = 1420
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “successes” = 1420
13/02/11 11:00:36 INFO slive.ReportWriter: Rate for measurement “op_count” = 252.175 operations/sec
13/02/11 11:00:36 INFO slive.ReportWriter: Rate for measurement “successes” = 252.175 successes/sec
13/02/11 11:00:36 INFO slive.ReportWriter: ————-
13/02/11 11:00:36 INFO slive.ReportWriter: Basic report for operation type ReadOp
13/02/11 11:00:36 INFO slive.ReportWriter: ————-
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “bad_files” = 1
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “bytes_read” = 25437917184
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “chunks_unverified” = 0
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “chunks_verified” = 3188125200
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “files_not_found” = 342
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “milliseconds_taken” = 268754
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “op_count” = 1420
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “successes” = 1077
13/02/11 11:00:36 INFO slive.ReportWriter: Rate for measurement “bytes_read” = 90.265 MB/sec
13/02/11 11:00:36 INFO slive.ReportWriter: Rate for measurement “op_count” = 5.284 operations/sec
13/02/11 11:00:36 INFO slive.ReportWriter: Rate for measurement “successes” = 4.007 successes/sec
13/02/11 11:00:36 INFO slive.ReportWriter: ————-
13/02/11 11:00:36 INFO slive.ReportWriter: Basic report for operation type RenameOp
13/02/11 11:00:36 INFO slive.ReportWriter: ————-
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “failures” = 1165
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “milliseconds_taken” = 1130
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “op_count” = 1420
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “successes” = 255
13/02/11 11:00:36 INFO slive.ReportWriter: Rate for measurement “op_count” = 1256.637 operations/sec
13/02/11 11:00:36 INFO slive.ReportWriter: Rate for measurement “successes” = 225.664 successes/sec
13/02/11 11:00:36 INFO slive.ReportWriter: ————-
13/02/11 11:00:36 INFO slive.ReportWriter: Basic report for operation type SliveMapper
13/02/11 11:00:36 INFO slive.ReportWriter: ————-
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “milliseconds_taken” = 765862
13/02/11 11:00:36 INFO slive.ReportWriter: Measurement “op_count” = 9940
13/02/11 11:00:36 INFO slive.ReportWriter: Rate for measurement “op_count” = 12.979 operations/sec
13/02/11 11:00:36 INFO slive.ReportWriter: ————-

avatar

About Plamen Jeliazkov

Subversion Tip of the Week

Creating a New Directory in Apache Subversion

There are two ways to create a new directory in Apache Subversion. You can either create the directory in your working copy and then commit it to the repository as a separate operation, or simply create the new directory in the central repository.

1) Creating a directory in the working copy:

svn mkdir (working-copy-location/name-of-new-directory)

In this example, we’re creating a new directory called ‘Release2’ in the branches folder. You’ll need to perform a commit to send this new directory to the repository and share it with the rest of the team.

mkdir working copy

2) Creating a directory in the repository:

svn mkdir -m “log message” (repository-URL/name-of-new-directory)

mkdir url

3) The –parents Option

Note that regardless of whether you’re creating a new directory in the repository or in a working copy, the intermediate directories must already exist. If you need to create the  intermediate directories, you must use the –parents option.

In this example, we’re creating two directories in the ‘NewRepo’ repositories, a ‘Releases’ directory and a ‘Release3’ directory.

svn mkdir with parent switch

Looking for an easy-to-use cross platform Subversion client? Claim your free 30 day trial of SmartSVN Professional by visiting: www.smartsvn.com/download